diff --git a/physics/GFS_DCNV_generic.F90 b/physics/GFS_DCNV_generic.F90 index 5920a685c..43dd6460c 100644 --- a/physics/GFS_DCNV_generic.F90 +++ b/physics/GFS_DCNV_generic.F90 @@ -20,34 +20,40 @@ end subroutine GFS_DCNV_generic_pre_finalize !! | ldiag3d | flag_diagnostics_3D | flag for 3d diagnostic fields | flag | 0 | logical | | in | F | !! | cnvgwd | flag_convective_gravity_wave_drag | flag for conv gravity wave drag | flag | 0 | logical | | in | F | !! | lgocart | flag_gocart | flag for 3d diagnostic fields for gocart 1 | flag | 0 | logical | | in | F | +!! | do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | in | F | +!! | isppt_deep | flag_for_combination_of_sppt_with_isppt_deep | switch for combination with isppt_deep. | flag | 0 | logical | | in | F | !! | gu0 | x_wind_updated_by_physics | zonal wind updated by physics | m s-1 | 2 | real | kind_phys | in | F | !! | gv0 | y_wind_updated_by_physics | meridional wind updated by physics | m s-1 | 2 | real | kind_phys | in | F | !! | gt0 | air_temperature_updated_by_physics | temperature updated by physics | K | 2 | real | kind_phys | in | F | -!! | gq0_water_vapor | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | in | F | +!! | gq0_water_vapor | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | !! | save_u | x_wind_save | x-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | inout | F | !! | save_v | y_wind_save | y-wind before entering a physics scheme | m s-1 | 2 | real | kind_phys | inout | F | !! | save_t | air_temperature_save | air temperature before entering a physics scheme | K | 2 | real | kind_phys | inout | F | !! | save_qv | water_vapor_specific_humidity_save | water vapor specific humidity before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | ca_deep | fraction_of_cellular_automata_for_deep_convection | fraction of cellular automata for deep convection | frac | 1 | real | kind_phys | in | F | !! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! - subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv0, gt0, gq0_water_vapor, & - save_u, save_v, save_t, save_qv, errmsg, errflg) + subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, do_ca, & + isppt_deep, gu0, gv0, gt0, gq0_water_vapor, & + save_u, save_v, save_t, save_qv, ca_deep, & + errmsg, errflg) use machine, only: kind_phys implicit none integer, intent(in) :: im, levs - logical, intent(in) :: ldiag3d, cnvgwd, lgocart - real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0 - real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0 - real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0 - real(kind=kind_phys), dimension(im,levs), intent(in) :: gq0_water_vapor + logical, intent(in) :: ldiag3d, cnvgwd, lgocart, do_ca, isppt_deep + real(kind=kind_phys), dimension(im,levs), intent(in) :: gu0 + real(kind=kind_phys), dimension(im,levs), intent(in) :: gv0 + real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0 + real(kind=kind_phys), dimension(im,levs), intent(inout) :: gq0_water_vapor real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_u real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_v real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_t real(kind=kind_phys), dimension(im,levs), intent(inout) :: save_qv + real(kind=kind_phys), dimension(im), intent(in) :: ca_deep character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -57,7 +63,15 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv errmsg = '' errflg = 0 - if (ldiag3d) then + if (do_ca) then + do k=1,levs + do i=1,im + gq0_water_vapor(i,k) = gq0_water_vapor(i,k)*(1.0 + ca_deep(i)/500.) + enddo + enddo + endif + + if (ldiag3d .or. isppt_deep) then do k=1,levs do i=1,im save_t(i,k) = gt0(i,k) @@ -69,7 +83,7 @@ subroutine GFS_DCNV_generic_pre_run (im, levs, ldiag3d, cnvgwd, lgocart, gu0, gv save_t(1:im,:) = gt0(1:im,:) endif ! end if_ldiag3d/cnvgwd - if (ldiag3d .or. lgocart) then + if (ldiag3d .or. lgocart .or. isppt_deep) then save_qv(1:im,:) = gq0_water_vapor(1:im,:) endif ! end if_ldiag3d/lgocart @@ -97,6 +111,8 @@ end subroutine GFS_DCNV_generic_post_finalize !! | lgocart | flag_gocart | flag for 3d diagnostic fields for gocart 1 | flag | 0 | logical | | in | F | !! | ras | flag_for_ras_deep_convection | flag for ras convection scheme | flag | 0 | logical | | in | F | !! | cscnv | flag_for_Chikira_Sugiyama_deep_convection | flag for Chikira-Sugiyama convection | flag | 0 | logical | | in | F | +!! | do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | in | F | +!! | isppt_deep | flag_for_combination_of_sppt_with_isppt_deep | switch for combination with isppt_deep. | flag | 0 | logical | | in | F | !! | frain | dynamics_to_physics_timestep_ratio | ratio of dynamics timestep to physics timestep | none | 0 | real | kind_phys | in | F | !! | rain1 | lwe_thickness_of_deep_convective_precipitation_amount | deep convective rainfall amount on physics timestep | m | 1 | real | kind_phys | in | F | !! | dtf | time_step_for_dynamics | dynamics timestep | s | 0 | real | kind_phys | in | F | @@ -138,21 +154,27 @@ end subroutine GFS_DCNV_generic_post_finalize !! | cnvc | convective_cloud_cover | convective cloud cover | frac | 2 | real | kind_phys | inout | F | !! | cnvw_phy_f3d | convective_cloud_water_mixing_ratio_in_phy_f3d | convective cloud water mixing ratio in the phy_f3d array | kg kg-1 | 2 | real | kind_phys | inout | F | !! | cnvc_phy_f3d | convective_cloud_cover_in_phy_f3d | convective cloud cover in the phy_f3d array | frac | 2 | real | kind_phys | inout | F | +!! | cape | convective_available_potential_energy_for_coupling | convective available potential energy for coupling DH* CHECK THIS DOESN'T MAKE SENSE!!! *DH | m2 s-2 | 1 | real | kind_phys | inout | F | +!! | tconvtend | tendency_of_air_temperature_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of air temperature due to deep convection | K | 2 | real | kind_phys | inout | F | +!! | qconvtend | tendency_of_water_vapor_specific_humidity_due_to_deep_convection_for_coupling_on_physics_timestep | tendency of specific humidity due to deep convection | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | uconvtend | tendency_of_x_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_x_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | inout | F | +!! | vconvtend | tendency_of_y_wind_due_to_deep_convection_for_coupling_on_physics_timestep | tendency_of_y_wind_due_to_deep_convection | m s-1 | 2 | real | kind_phys | inout | F | !! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! - subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cscnv, & - frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, gq0_water_vapor, & - ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, & - rainc, cldwrk, cnvprcp, cnvprcpb, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, dqdti, & - cnvqci, upd_mfi, dwn_mfi, det_mfi, cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, errmsg, errflg) + subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cscnv, do_ca, & + isppt_deep, frain, rain1, dtf, cld1d, save_u, save_v, save_t, save_qv, gu0, gv0, gt0, & + gq0_water_vapor, ud_mf, dd_mf, dt_mf, con_g, clw_ice, clw_liquid, npdf3d, num_p3d, ncnvcld3d, & + rainc, cldwrk, cnvprcp, cnvprcpb, dt3dt, dq3dt, du3dt, dv3dt, upd_mf, dwn_mf, det_mf, dqdti, & + cnvqci, upd_mfi, dwn_mfi, det_mfi, cnvw, cnvc, cnvw_phy_f3d, cnvc_phy_f3d, & + cape, tconvtend, qconvtend, uconvtend, vconvtend, errmsg, errflg) use machine, only: kind_phys implicit none integer, intent(in) :: im, levs - logical, intent(in) :: lssav, ldiag3d, lgocart, ras, cscnv + logical, intent(in) :: lssav, ldiag3d, lgocart, ras, cscnv, do_ca, isppt_deep real(kind=kind_phys), intent(in) :: frain, dtf real(kind=kind_phys), dimension(im), intent(in) :: rain1, cld1d @@ -176,6 +198,8 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs ! as long as these do not get used when not allocated (it is still invalid Fortran code, though). real(kind=kind_phys), dimension(:,:), intent(inout) :: cnvw_phy_f3d, cnvc_phy_f3d ! *DH + real(kind=kind_phys), dimension(im), intent(inout) :: cape + real(kind=kind_phys), dimension(im,levs), intent(inout) :: tconvtend, qconvtend, uconvtend, vconvtend character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -187,23 +211,28 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs errflg = 0 if (.not. ras .and. .not. cscnv) then - if (npdf3d == 3 .and. num_p3d == 4) then - do k=1,levs - do i=1,im - cnvw_phy_f3d(i,k) = cnvw(i,k) - cnvc_phy_f3d(i,k) = cnvc(i,k) - cnvw(i,k) = 0.0 - cnvc(i,k) = 0.0 - enddo - enddo - elseif (npdf3d == 0 .and. ncnvcld3d == 1) then - do k=1,levs - do i=1,im - cnvw_phy_f3d(i,k) = cnvw(i,k) - cnvw(i,k) = 0.0 - enddo - enddo - endif + if(do_ca) then + do i=1,im + cape(i)=cld1d(i) + enddo + endif + if (npdf3d == 3 .and. num_p3d == 4) then + do k=1,levs + do i=1,im + cnvw_phy_f3d(i,k) = cnvw(i,k) + cnvc_phy_f3d(i,k) = cnvc(i,k) + cnvw(i,k) = 0.0 + cnvc(i,k) = 0.0 + enddo + enddo + elseif (npdf3d == 0 .and. ncnvcld3d == 1) then + do k=1,levs + do i=1,im + cnvw_phy_f3d(i,k) = cnvw(i,k) + cnvw(i,k) = 0.0 + enddo + enddo + endif endif ! if (.not. ras .and. .not. cscnv) do i=1,im @@ -247,6 +276,13 @@ subroutine GFS_DCNV_generic_post_run (im, levs, lssav, ldiag3d, lgocart, ras, cs enddo endif ! if (lgocart) + if (isppt_deep) then + tconvtend = gt0 - save_t + qconvtend = gq0_water_vapor - save_qv + uconvtend = gu0 - save_u + vconvtend = gv0 - save_v + endif + end subroutine GFS_DCNV_generic_post_run end module GFS_DCNV_generic_post diff --git a/physics/GFS_MP_generic.F90 b/physics/GFS_MP_generic.F90 index 4b65811ff..6a594d7da 100644 --- a/physics/GFS_MP_generic.F90 +++ b/physics/GFS_MP_generic.F90 @@ -129,6 +129,7 @@ end subroutine GFS_MP_generic_post_init !! | graupel | lwe_thickness_of_graupel_amount_on_dynamics_timestep | graupel fall at this time step | m | 1 | real | kind_phys | inout | F | !! | save_t | air_temperature_save | air temperature before entering a physics scheme | K | 2 | real | kind_phys | in | F | !! | save_qv | water_vapor_specific_humidity_save | water vapor specific humidity before entering a physics scheme | kg kg-1 | 2 | real | kind_phys | in | F | +!! | rain0 | lwe_thickness_of_explicit_rain_amount | explicit rain on physics timestep | m | 1 | real | kind_phys | in | F | !! | ice0 | lwe_thickness_of_ice_amount | ice fall on physics timestep | m | 1 | real | kind_phys | in | F | !! | snow0 | lwe_thickness_of_snow_amount | snow fall on physics timestep | m | 1 | real | kind_phys | in | F | !! | graupel0 | lwe_thickness_of_graupel_amount | graupel fall on physics timestep | m | 1 | real | kind_phys | in | F | @@ -166,6 +167,7 @@ end subroutine GFS_MP_generic_post_init !! | iceprv | lwe_thickness_of_ice_amount_from_previous_timestep | ice amount from previous timestep | m | 1 | real | kind_phys | inout | F | !! | snowprv | lwe_thickness_of_snow_amount_from_previous_timestep | snow amount from previous timestep | m | 1 | real | kind_phys | inout | F | !! | graupelprv | lwe_thickness_of_graupel_amount_from_previous_timestep | graupel amount from previous timestep | m | 1 | real | kind_phys | inout | F | +!! | dtp | time_step_for_physics | physics timestep | s | 0 | real | kind_phys | in | F | !! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! @@ -173,11 +175,11 @@ end subroutine GFS_MP_generic_post_init !! @{ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, ntrac, imp_physics, imp_physics_gfdl, & imp_physics_thompson, cal_pre, lssav, ldiag3d, cplflx, cplchm, con_g, dtf, frain, rainc, rain1, rann, xlat, xlon, & - gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, ice0, snow0, graupel0, del, & + gt0, gq0, prsl, prsi, phii, tsfc, ice, snow, graupel, save_t, save_qv, rain0, ice0, snow0, graupel0, del, & rain, domr_diag, domzr_diag, domip_diag, doms_diag, tprcp, srflag, totprcp, totice, totsnw, & totgrp, totprcpb, toticeb, totsnwb, totgrpb, dt3dt, dq3dt, rain_cpl, rainc_cpl, snow_cpl, pwat, & do_sppt, dtdtr, dtdtc, drain_cpl, dsnow_cpl, lsm, lsm_ruc, raincprv, rainncprv, iceprv, snowprv, graupelprv, & - errmsg, errflg) + dtp, errmsg, errflg) ! use machine, only: kind_phys @@ -189,7 +191,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt real(kind=kind_phys), intent(in) :: dtf, frain, con_g real(kind=kind_phys), dimension(im), intent(in) :: rainc, rain1, xlat, xlon, tsfc real(kind=kind_phys), dimension(im), intent(inout) :: ice, snow, graupel - real(kind=kind_phys), dimension(im), intent(in) :: ice0, snow0, graupel0 + real(kind=kind_phys), dimension(im), intent(in) :: rain0, ice0, snow0, graupel0 real(kind=kind_phys), dimension(ix,nrcm), intent(in) :: rann real(kind=kind_phys), dimension(im,levs), intent(in) :: gt0, prsl, save_t, save_qv, del real(kind=kind_phys), dimension(im,levs+1), intent(in) :: prsi, phii @@ -214,14 +216,21 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt real(kind=kind_phys), dimension(im), intent(inout) :: snowprv real(kind=kind_phys), dimension(im), intent(inout) :: graupelprv + real(kind=kind_phys), intent(in) :: dtp + ! CCPP error handling character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg + ! DH* TODO: CLEANUP, all of these should be coming in through the argument list + real(kind=kind_phys), parameter :: con_p001= 0.001d0 + real(kind=kind_phys), parameter :: con_day = 86400.d0 + real(kind=kind_phys), parameter :: rainmin = 1.0e-13 real(kind=kind_phys), parameter :: p850 = 85000.0 + ! *DH integer :: i, k, ic - real(kind=kind_phys) :: crain, csnow, onebg + real(kind=kind_phys) :: crain, csnow, onebg, tem, total_precip real(kind=kind_phys), dimension(im) :: domr, domzr, domip, doms, t850, work1 ! Initialize CCPP error handling variables @@ -350,6 +359,7 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt if (imp_physics == imp_physics_gfdl .or. imp_physics == imp_physics_thompson) then ! determine convective rain/snow by surface temperature ! determine large-scale rain/snow by rain/snow coming out directly from MP + tem = dtp * con_p001 / con_day do i = 1, im !tprcp(i) = max(0.0, rain(i) )! clu: rain -> tprcp ! DH now lines 245-250 srflag(i) = 0. ! clu: default srflag as 'rain' (i.e. 0) @@ -360,10 +370,28 @@ subroutine GFS_MP_generic_post_run(im, ix, levs, kdt, nrcm, ncld, nncl, ntcw, nt crain = 0.0 csnow = rainc(i) endif -! if (snow0(i,1)+ice0(i,1)+graupel0(i,1)+csnow > rain0(i,1)+crain) then - if (snow0(i)+ice0(i)+graupel0(i)+csnow > 0.0) then - srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1) +! if (snow0(i,1)+ice0(i,1)+graupel0(i,1)+csnow > rain0(i,1)+crain) then +! if (snow0(i)+ice0(i)+graupel0(i)+csnow > 0.0) then +! Sfcprop%srflag(i) = 1. ! clu: set srflag to 'snow' (i.e. 1) +! endif +! compute fractional srflag + total_precip = snow0(i)+ice0(i)+graupel0(i)+rain0(i)+rainc(i) + ! DH* + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, tem: ", i, tem + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, snow0: ", i, snow0(i) + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, ice0: ", i, ice0(i) + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, graupel0: ", i, graupel0(i) + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, rain0: ", i, rain0(i) + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, rainc: ", i, rainc(i) + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, total_precip: ", i, total_precip + !write(0,'(a,i6,l)') "DH DEBUG srflag: i, total_precip*tem > rainmin: ", i, total_precip*tem > rainmin + ! *DH + if (total_precip*tem > rainmin) then + srflag(i) = (snow0(i)+ice0(i)+graupel0(i)+csnow)/total_precip endif + ! DH* + !write(0,'(a,i6,e35.25)') "DH DEBUG srflag: i, srflag: ", i, srflag(i) + ! *DH enddo elseif( .not. cal_pre) then do i = 1, im diff --git a/physics/GFS_phys_time_vary.fv3.F90 b/physics/GFS_phys_time_vary.fv3.F90 index f735d457d..594788e50 100644 --- a/physics/GFS_phys_time_vary.fv3.F90 +++ b/physics/GFS_phys_time_vary.fv3.F90 @@ -56,6 +56,7 @@ subroutine GFS_phys_time_vary_init (Data, Model, Interstitial, nthrds, errmsg, e ! Local variables integer :: nb, nblks, nt integer :: i, j, ix + logical :: non_uniform_blocks ! Initialize CCPP error handling variables errmsg = '' @@ -64,12 +65,31 @@ subroutine GFS_phys_time_vary_init (Data, Model, Interstitial, nthrds, errmsg, e if (is_initialized) return nblks = size(Model%blksz) + + ! Non-uniform blocks require special handling: instead + ! of nthrds elements of the Interstitial array, there are + ! nthrds+1 elements. The extra Interstitial(nthrds+1) is + ! allocated for the smaller block length of the last block, + ! while all other elements are allocated to the maximum + ! block length (which is the same for all blocks except + ! the last block). + if (minval(Model%blksz)==maxval(Model%blksz)) then + non_uniform_blocks = .false. + else + non_uniform_blocks = .true. + end if + ! Consistency check - number of threads passed in via the argument list ! has to match the size of the Interstitial data type. - if (.not. nthrds == size(Interstitial)) then + if (.not. non_uniform_blocks .and. nthrds/=size(Interstitial)) then write(errmsg,'(*(a))') 'Logic error: nthrds does not match size of Interstitial variable' errflg = 1 return + else if (non_uniform_blocks .and. nthrds+1/=size(Interstitial)) then + write(errmsg,'(*(a))') 'Logic error: nthrds+1 does not match size of Interstitial variable ' // & + '(including extra last element for shorter blocksizes)' + errflg = 1 + return end if !$OMP parallel num_threads(nthrds) default(none) & @@ -77,7 +97,7 @@ subroutine GFS_phys_time_vary_init (Data, Model, Interstitial, nthrds, errmsg, e !$OMP shared (Model,Data,Interstitial,errmsg,errflg) & !$OMP shared (levozp,oz_coeff,oz_pres) & !$OMP shared (levh2o,h2o_coeff,h2o_pres) & -!$OMP shared (ntrcaer,nblks) +!$OMP shared (ntrcaer,nblks,nthrds,non_uniform_blocks) #ifdef OPENMP nt = omp_get_thread_num()+1 @@ -161,13 +181,26 @@ subroutine GFS_phys_time_vary_init (Data, Model, Interstitial, nthrds, errmsg, e ! Update values of oz_pres in Interstitial data type for all threads if (Model%ntoz > 0) then Interstitial(nt)%oz_pres = oz_pres +!$OMP single + if (non_uniform_blocks) then + ! For non-uniform block sizes, set Interstitial(nthrds+1)%oz_pres + Interstitial(nthrds+1)%oz_pres = oz_pres + end if +!$OMP end single nowait end if ! Update values of h2o_pres in Interstitial data type for all threads if (Model%h2o_phys) then Interstitial(nt)%h2o_pres = h2o_pres +!$OMP single + if (non_uniform_blocks) then + ! For non-uniform block sizes, set Interstitial(nthrds+1)%oz_pres + Interstitial(nthrds+1)%h2o_pres = h2o_pres + end if +!$OMP end single nowait end if + !--- read in and initialize ozone if (Model%ntoz > 0) then !$OMP do schedule (dynamic,1) diff --git a/physics/GFS_rrtmg_pre.F90 b/physics/GFS_rrtmg_pre.F90 index 3796d68dc..137d14576 100644 --- a/physics/GFS_rrtmg_pre.F90 +++ b/physics/GFS_rrtmg_pre.F90 @@ -662,6 +662,27 @@ subroutine GFS_rrtmg_pre_run (Model, Grid, Sfcprop, Statein, & ! input endif elseif (Model%imp_physics == Model%imp_physics_gfdl) then ! GFDL MP cldcov(1:IM,1+kd:LM+kd) = tracer1(1:IM,1:LM,Model%ntclamt) + if(Model%effr_in) then + do k=1,lm + k1 = k + kd + do i=1,im + effrl(i,k1) = Tbd%phy_f3d(i,k,1) + effri(i,k1) = Tbd%phy_f3d(i,k,2) + effrr(i,k1) = Tbd%phy_f3d(i,k,3) + effrs(i,k1) = Tbd%phy_f3d(i,k,4) +! if(Model%me==0) then +! if(effrl(i,k1)> 5.0) then +! write(6,*) 'rad driver:cloud radii:',Model%kdt, i,k1, & +! effrl(i,k1) +! endif +! if(effrs(i,k1)==0.0) then +! write(6,*) 'rad driver:snow mixing ratio:',Model%kdt, i,k1, & +! tracer1(i,k,ntsw) +! endif +! endif + enddo + enddo + endif else ! neither of the other two cases cldcov = 0.0 endif diff --git a/physics/GFS_stochastics.F90 b/physics/GFS_stochastics.F90 index 9829a1856..424d8cdab 100644 --- a/physics/GFS_stochastics.F90 +++ b/physics/GFS_stochastics.F90 @@ -87,6 +87,7 @@ subroutine GFS_stochastics_run (im, km, do_sppt, use_zmtnblck, do_shum, do_skeb, logical, intent(in) :: use_zmtnblck logical, intent(in) :: do_shum logical, intent(in) :: do_skeb + !logical, intent(in) :: isppt_deep real(kind_phys), dimension(1:im), intent(in) :: zmtnblck ! sppt_wts only allocated if do_sppt == .true. real(kind_phys), dimension(:,:), intent(inout) :: sppt_wts @@ -125,6 +126,11 @@ subroutine GFS_stochastics_run (im, km, do_sppt, use_zmtnblck, do_shum, do_skeb, ! drain_cpl, dsnow_cpl only allocated if do_sppt == .true. real(kind_phys), dimension(:), intent(in) :: drain_cpl real(kind_phys), dimension(:), intent(in) :: dsnow_cpl + ! tconvtend ... vconvtend only allocated if isppt_deep == .true. + !real(kind_phys), dimension(:,:), intent(in) :: tconvtend + !real(kind_phys), dimension(:,:), intent(in) :: qconvtend + !real(kind_phys), dimension(:,:), intent(in) :: uconvtend + !real(kind_phys), dimension(:,:), intent(in) :: vconvtend character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -161,11 +167,22 @@ subroutine GFS_stochastics_run (im, km, do_sppt, use_zmtnblck, do_shum, do_skeb, endif sppt_wts_inv(i,km-k+1)=sppt_wts(i,k) + !if(isppt_deep)then + + ! upert = (gu0(i,k) - ugrs(i,k) - uconvtend(i,k)) + uconvtend(i,k) * sppt_wts(i,k) + ! vpert = (gv0(i,k) - vgrs(i,k) - vconvtend(i,k)) + vconvtend(i,k) * sppt_wts(i,k) + ! tpert = (gt0(i,k) - tgrs(i,k) - dtdtr(i,k) - tconvtend(i,k)) + tconvtend(i,k) * sppt_wts(i,k) + ! qpert = (gq0(i,k) - qgrs(i,k) - qconvtend(i,k)) + qconvtend(i,k) * sppt_wts(i,k) + + !else + upert = (gu0(i,k) - ugrs(i,k)) * sppt_wts(i,k) vpert = (gv0(i,k) - vgrs(i,k)) * sppt_wts(i,k) tpert = (gt0(i,k) - tgrs(i,k) - dtdtr(i,k)) * sppt_wts(i,k) qpert = (gq0(i,k) - qgrs(i,k)) * sppt_wts(i,k) + !endif + gu0(i,k) = ugrs(i,k)+upert gv0(i,k) = vgrs(i,k)+vpert @@ -177,6 +194,22 @@ subroutine GFS_stochastics_run (im, km, do_sppt, use_zmtnblck, do_shum, do_skeb, endif enddo enddo + + !if(isppt_deep)then + ! tprcp(:) = tprcp(:) + (sppt_wts(:,15) - 1 )*rainc(:) + ! totprcp(:) = totprcp(:) + (sppt_wts(:,15) - 1 )*rainc(:) + ! cnvprcp(:) = cnvprcp(:) + (sppt_wts(:,15) - 1 )*rainc(:) + !! ! bucket precipitation adjustment due to sppt + ! totprcpb(:) = totprcpb(:) + (sppt_wts(:,15) - 1 )*rainc(:) + ! cnvprcpb(:) = cnvprcpb(:) + (sppt_wts(:,15) - 1 )*rainc(:) + + ! if (cplflx) then !Need to make proper adjustments for deep convection only perturbations + ! rain_cpl(:) = rain_cpl(:) + (sppt_wts(:,15) - 1.0)*drain_cpl(:) + ! snow_cpl(:) = snow_cpl(:) + (sppt_wts(:,15) - 1.0)*dsnow_cpl(:) + ! endif + + !else + ! instantaneous precip rate going into land model at the next time step tprcp(:) = sppt_wts(:,15)*tprcp(:) totprcp(:) = totprcp(:) + (sppt_wts(:,15) - 1 )*rain(:) @@ -190,7 +223,9 @@ subroutine GFS_stochastics_run (im, km, do_sppt, use_zmtnblck, do_shum, do_skeb, rain_cpl(:) = rain_cpl(:) + (sppt_wts(:,15) - 1.0)*drain_cpl(:) snow_cpl(:) = snow_cpl(:) + (sppt_wts(:,15) - 1.0)*dsnow_cpl(:) endif - + + !endif + endif if (do_shum) then diff --git a/physics/GFS_surface_generic.F90 b/physics/GFS_surface_generic.F90 index 8568542a6..d20cb9a95 100644 --- a/physics/GFS_surface_generic.F90 +++ b/physics/GFS_surface_generic.F90 @@ -232,6 +232,7 @@ end subroutine GFS_surface_generic_post_finalize !! |----------------|---------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------|-------------|------|------------|-----------|--------|----------| !! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | !! | cplflx | flag_for_flux_coupling | flag controlling cplflx collection (default off) | flag | 0 | logical | | in | F | +!! | cplwav | flag_for_wave_coupling | flag controlling cplwav collection (default off) | flag | 0 | logical | | in | F | !! | lssav | flag_diagnostics | logical flag for storing diagnostics | flag | 0 | logical | | in | F | !! | islmsk | sea_land_ice_mask | landmask: sea/land/ice=0/1/2 | flag | 1 | integer | | in | F | !! | dtf | time_step_for_dynamics | dynamics timestep | s | 0 | real | kind_phys | in | F | @@ -317,7 +318,7 @@ end subroutine GFS_surface_generic_post_finalize !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! #endif - subroutine GFS_surface_generic_post_run (im, cplflx, lssav, islmsk, dtf, ep1d, gflx, tgrs_1, qgrs_1, ugrs_1, vgrs_1, & + subroutine GFS_surface_generic_post_run (im, cplflx, cplwav, lssav, islmsk, dtf, ep1d, gflx, tgrs_1, qgrs_1, ugrs_1, vgrs_1, & adjsfcdlw, adjsfcdsw, adjnirbmd, adjnirdfd, adjvisbmd, adjvisdfd, adjsfculw, adjnirbmu, adjnirdfu, adjvisbmu, adjvisdfu, & t2m, q2m, u10m, v10m, tsfc, pgr, xcosz, evbs, evcw, trans, sbsno, snowc, snohf, & epi, gfluxi, t1, q1, u1, v1, dlwsfci_cpl, dswsfci_cpl, dlwsfc_cpl, dswsfc_cpl, dnirbmi_cpl, dnirdfi_cpl, dvisbmi_cpl, & @@ -331,7 +332,7 @@ subroutine GFS_surface_generic_post_run (im, cplflx, lssav, islmsk, dtf, ep1d, g implicit none integer, intent(in) :: im - logical, intent(in) :: cplflx, lssav + logical, intent(in) :: cplflx, cplwav, lssav integer, dimension(im), intent(in) :: islmsk real(kind=kind_phys), intent(in) :: dtf @@ -370,6 +371,13 @@ subroutine GFS_surface_generic_post_run (im, cplflx, lssav, islmsk, dtf, ep1d, g v1(i) = vgrs_1(i) enddo + if (cplflx .or. cplwav) then + do i=1,im + u10mi_cpl (i) = u10m(i) + v10mi_cpl (i) = v10m(i) + enddo + endif + if (cplflx) then do i=1,im dlwsfci_cpl (i) = adjsfcdlw(i) @@ -388,8 +396,6 @@ subroutine GFS_surface_generic_post_run (im, cplflx, lssav, islmsk, dtf, ep1d, g nlwsfc_cpl (i) = nlwsfc_cpl(i) + nlwsfci_cpl(i)*dtf t2mi_cpl (i) = t2m(i) q2mi_cpl (i) = q2m(i) - u10mi_cpl (i) = u10m(i) - v10mi_cpl (i) = v10m(i) tsfci_cpl (i) = tsfc(i) psurfi_cpl (i) = pgr(i) enddo diff --git a/physics/cs_conv.F90 b/physics/cs_conv.F90 index 0562acdf4..657313a91 100644 --- a/physics/cs_conv.F90 +++ b/physics/cs_conv.F90 @@ -81,6 +81,9 @@ subroutine cs_conv_pre_run(im, levs, ntrac, ncld, q, clw1, clw2, & fscav(:) = 0.0 do k=1,levs do i=1,im + ! DH* note - save_q1 assignment may be redundant, + ! because already done in GFS_DCNV_generic_pre? + ! Keep for using cs_conv w/o GFS_DCNV_generic_pre? save_q1(i,k) = q(i,k) save_q2(i,k) = max(0.0,clw2(i,k)) save_q3(i,k) = max(0.0,clw1(i,k)) diff --git a/physics/gcycle.F90 b/physics/gcycle.F90 index ff3860085..714ed81ff 100644 --- a/physics/gcycle.F90 +++ b/physics/gcycle.F90 @@ -17,6 +17,10 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) ! ! Local variables ! --------------- + integer :: & + I_INDEX(Model%nx*Model%ny), & + J_INDEX(Model%nx*Model%ny) + real(kind=kind_phys) :: & RLA (Model%nx*Model%ny), & RLO (Model%nx*Model%ny), & @@ -30,7 +34,7 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) TG3FCS (Model%nx*Model%ny), & CNPFCS (Model%nx*Model%ny), & AISFCS (Model%nx*Model%ny), & - F10MFCS(Model%nx*Model%ny), & +! F10MFCS(Model%nx*Model%ny), & VEGFCS (Model%nx*Model%ny), & VETFCS (Model%nx*Model%ny), & SOTFCS (Model%nx*Model%ny), & @@ -51,9 +55,10 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) STCFC1 (Model%nx*Model%ny*Model%lsoil), & SLCFC1 (Model%nx*Model%ny*Model%lsoil) + character(len=6) :: tile_num_ch real(kind=kind_phys), parameter :: pifac=180.0/pi real(kind=kind_phys) :: sig1t - integer :: npts, len, nb, ix, ls, ios + integer :: npts, len, nb, ix, jx, ls, ios logical :: exists ! !@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@ -61,6 +66,22 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) ! if (Model%me .eq. 0) print *,' nlats=',nlats,' lonsinpe=' ! *,lonsinpe(0,1) + tile_num_ch = " " + if (Model%tile_num < 10) then + write(tile_num_ch, "(a4,i1)") "tile", Model%tile_num + else + write(tile_num_ch, "(a4,i2)") "tile", Model%tile_num + endif + + len = 0 + do jx = Model%jsc, (Model%jsc+Model%ny-1) + do ix = Model%isc, (Model%isc+Model%nx-1) + len = len + 1 + i_index(len) = ix + j_index(len) = jx + enddo + enddo + sig1t = 0.0 npts = Model%nx*Model%ny ! @@ -82,7 +103,7 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) ZORFCS (len) = Sfcprop(nb)%zorl (ix) TG3FCS (len) = Sfcprop(nb)%tg3 (ix) CNPFCS (len) = Sfcprop(nb)%canopy (ix) - F10MFCS (len) = Sfcprop(nb)%f10m (ix) +! F10MFCS (len) = Sfcprop(nb)%f10m (ix) VEGFCS (len) = Sfcprop(nb)%vfrac (ix) VETFCS (len) = Sfcprop(nb)%vtype (ix) SOTFCS (len) = Sfcprop(nb)%stype (ix) @@ -152,12 +173,13 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) SIHFCS, SICFCS, SITFCS, SWDFCS, SLCFC1, & VMNFCS, VMXFCS, SLPFCS, ABSFCS, TSFFCS, & SNOFCS, ZORFCS, ALBFC1, TG3FCS, CNPFCS, & - SMCFC1, STCFC1, SLIFCS, AISFCS, F10MFCS, & + SMCFC1, STCFC1, SLIFCS, AISFCS, & VEGFCS, VETFCS, SOTFCS, ALFFC1, CVFCS, & CVBFCS, CVTFCS, Model%me, Model%nlunit, & size(Model%input_nml_file), & Model%input_nml_file, & - Model%ialb, Model%isot, Model%ivegsrc) + Model%ialb, Model%isot, Model%ivegsrc, & + trim(tile_num_ch), i_index, j_index) #ifndef INTERNAL_FILE_NML close (Model%nlunit) #endif @@ -176,7 +198,7 @@ SUBROUTINE GCYCLE (nblks, Model, Grid, Sfcprop, Cldprop) Sfcprop(nb)%zorl (ix) = ZORFCS (len) Sfcprop(nb)%tg3 (ix) = TG3FCS (len) Sfcprop(nb)%canopy (ix) = CNPFCS (len) - Sfcprop(nb)%f10m (ix) = F10MFCS (len) +! Sfcprop(nb)%f10m (ix) = F10MFCS (len) Sfcprop(nb)%vfrac (ix) = VEGFCS (len) Sfcprop(nb)%vtype (ix) = VETFCS (len) Sfcprop(nb)%stype (ix) = SOTFCS (len) diff --git a/physics/gfdl_cloud_microphys.F90 b/physics/gfdl_cloud_microphys.F90 index efcfaf9ca..044b57de4 100644 --- a/physics/gfdl_cloud_microphys.F90 +++ b/physics/gfdl_cloud_microphys.F90 @@ -3,7 +3,10 @@ !! \cite chen_and_lin_2013 ). module gfdl_cloud_microphys - use gfdl_cloud_microphys_mod, only: gfdl_cloud_microphys_mod_init, gfdl_cloud_microphys_mod_driver, gfdl_cloud_microphys_mod_end + use gfdl_cloud_microphys_mod, only: gfdl_cloud_microphys_mod_init, & + gfdl_cloud_microphys_mod_driver, & + gfdl_cloud_microphys_mod_end, & + cloud_diagnosis implicit none @@ -123,47 +126,56 @@ end subroutine gfdl_cloud_microphys_finalize !! !>@brief The subroutine executes the full GFDL cloud microphysics. !! \section arg_table_gfdl_cloud_microphys_run Argument Table -!! | local_name | standard_name | long_name | units | rank | type | kind | intent| optional | -!! |------------------|------------------------------------------------------------|-----------------------------------------------------------------------|------------|------|-----------|-----------|-------|----------| -!! | levs | vertical_dimension | number of vertical levels | count | 0 | integer | | in | F | -!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | -!! | con_g | gravitational_acceleration | gravitational acceleration | m s-2 | 0 | real | kind_phys | in | F | -!! | con_fvirt | ratio_of_vapor_to_dry_air_gas_constants_minus_one | rv/rd - 1 (rv = ideal gas constant for water vapor) | none | 0 | real | kind_phys | in | F | -!! | con_rd | gas_constant_dry_air | ideal gas constant for dry air | J kg-1 K-1 | 0 | real | kind_phys | in | F | -!! | frland | land_area_fraction | land area fraction | frac | 1 | real | kind_phys | in | F | -!! | garea | cell_area | area of grid cell | m2 | 1 | real | kind_phys | in | F | -!! | gq0 | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntcw | cloud_condensed_water_mixing_ratio_updated_by_physics | cloud condensed water mixing ratio updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntrw | rain_water_mixing_ratio_updated_by_physics | moist mixing ratio of rain updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntiw | ice_water_mixing_ratio_updated_by_physics | moist mixing ratio of cloud ice updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntsw | snow_water_mixing_ratio_updated_by_physics | moist mixing ratio of snow updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntgl | graupel_mixing_ratio_updated_by_physics | moist mixing ratio of graupel updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | -!! | gq0_ntclamt | cloud_fraction_updated_by_physics | cloud fraction updated by physics | frac | 2 | real | kind_phys | inout | F | -!! | gt0 | air_temperature_updated_by_physics | air temperature updated by physics | K | 2 | real | kind_phys | inout | F | -!! | gu0 | x_wind_updated_by_physics | zonal wind updated by physics | m s-1 | 2 | real | kind_phys | inout | F | -!! | gv0 | y_wind_updated_by_physics | meridional wind updated by physics | m s-1 | 2 | real | kind_phys | inout | F | -!! | vvl | omega | layer mean vertical velocity | Pa s-1 | 2 | real | kind_phys | in | F | -!! | prsl | air_pressure | mean layer pressure | Pa | 2 | real | kind_phys | in | F | -!! | phii | geopotential_at_interface | geopotential at model layer interfaces | m2 s-2 | 2 | real | kind_phys | in | F | -!! | del | air_pressure_difference_between_midlayers | air pressure difference between mid-layers | Pa | 2 | real | kind_phys | in | F | -!! | rain0 | lwe_thickness_of_explicit_rain_amount | explicit rain on physics timestep | m | 1 | real | kind_phys | out | F | -!! | ice0 | lwe_thickness_of_ice_amount | ice fall on physics timestep | m | 1 | real | kind_phys | out | F | -!! | snow0 | lwe_thickness_of_snow_amount | snow fall on physics timestep | m | 1 | real | kind_phys | out | F | -!! | graupel0 | lwe_thickness_of_graupel_amount | graupel fall on physics timestep | m | 1 | real | kind_phys | out | F | -!! | prcp0 | lwe_thickness_of_explicit_precipitation_amount | explicit precipitation (rain, ice, snow, graupel) on physics timestep | m | 1 | real | kind_phys | out | F | -!! | sr | ratio_of_snowfall_to_rainfall | snow ratio: ratio of snow to total precipitation | frac | 1 | real | kind_phys | out | F | -!! | dtp | time_step_for_physics | physics timestep | s | 0 | real | kind_phys | in | F | -!! | hydrostatic | flag_for_hydrostatic_solver | flag indicating hydrostatic solver | flag | 0 | logical | | in | F | -!! | phys_hydrostatic | flag_for_hydrostatic_heating_from_physics | flag indicating hydrostatic heating from physics | flag | 0 | logical | | in | F | -!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | -!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | +!! | local_name | standard_name | long_name | units | rank | type | kind | intent| optional | +!! |------------------|------------------------------------------------------------------|-----------------------------------------------------------------------|------------|------|-----------|-----------|-------|----------| +!! | levs | vertical_dimension | number of vertical levels | count | 0 | integer | | in | F | +!! | im | horizontal_loop_extent | horizontal loop extent | count | 0 | integer | | in | F | +!! | con_g | gravitational_acceleration | gravitational acceleration | m s-2 | 0 | real | kind_phys | in | F | +!! | con_fvirt | ratio_of_vapor_to_dry_air_gas_constants_minus_one | rv/rd - 1 (rv = ideal gas constant for water vapor) | none | 0 | real | kind_phys | in | F | +!! | con_rd | gas_constant_dry_air | ideal gas constant for dry air | J kg-1 K-1 | 0 | real | kind_phys | in | F | +!! | frland | land_area_fraction | land area fraction | frac | 1 | real | kind_phys | in | F | +!! | garea | cell_area | area of grid cell | m2 | 1 | real | kind_phys | in | F | +!! | gq0 | water_vapor_specific_humidity_updated_by_physics | water vapor specific humidity updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntcw | cloud_condensed_water_mixing_ratio_updated_by_physics | cloud condensed water mixing ratio updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntrw | rain_water_mixing_ratio_updated_by_physics | moist mixing ratio of rain updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntiw | ice_water_mixing_ratio_updated_by_physics | moist mixing ratio of cloud ice updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntsw | snow_water_mixing_ratio_updated_by_physics | moist mixing ratio of snow updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntgl | graupel_mixing_ratio_updated_by_physics | moist mixing ratio of graupel updated by physics | kg kg-1 | 2 | real | kind_phys | inout | F | +!! | gq0_ntclamt | cloud_fraction_updated_by_physics | cloud fraction updated by physics | frac | 2 | real | kind_phys | inout | F | +!! | gt0 | air_temperature_updated_by_physics | air temperature updated by physics | K | 2 | real | kind_phys | inout | F | +!! | gu0 | x_wind_updated_by_physics | zonal wind updated by physics | m s-1 | 2 | real | kind_phys | inout | F | +!! | gv0 | y_wind_updated_by_physics | meridional wind updated by physics | m s-1 | 2 | real | kind_phys | inout | F | +!! | vvl | omega | layer mean vertical velocity | Pa s-1 | 2 | real | kind_phys | in | F | +!! | prsl | air_pressure | mean layer pressure | Pa | 2 | real | kind_phys | in | F | +!! | phii | geopotential_at_interface | geopotential at model layer interfaces | m2 s-2 | 2 | real | kind_phys | in | F | +!! | del | air_pressure_difference_between_midlayers | air pressure difference between mid-layers | Pa | 2 | real | kind_phys | in | F | +!! | rain0 | lwe_thickness_of_explicit_rain_amount | explicit rain on physics timestep | m | 1 | real | kind_phys | out | F | +!! | ice0 | lwe_thickness_of_ice_amount | ice fall on physics timestep | m | 1 | real | kind_phys | out | F | +!! | snow0 | lwe_thickness_of_snow_amount | snow fall on physics timestep | m | 1 | real | kind_phys | out | F | +!! | graupel0 | lwe_thickness_of_graupel_amount | graupel fall on physics timestep | m | 1 | real | kind_phys | out | F | +!! | prcp0 | lwe_thickness_of_explicit_precipitation_amount | explicit precipitation (rain, ice, snow, graupel) on physics timestep | m | 1 | real | kind_phys | out | F | +!! | sr | ratio_of_snowfall_to_rainfall | snow ratio: ratio of snow to total precipitation | frac | 1 | real | kind_phys | out | F | +!! | dtp | time_step_for_physics | physics timestep | s | 0 | real | kind_phys | in | F | +!! | hydrostatic | flag_for_hydrostatic_solver | flag indicating hydrostatic solver | flag | 0 | logical | | in | F | +!! | phys_hydrostatic | flag_for_hydrostatic_heating_from_physics | flag indicating hydrostatic heating from physics | flag | 0 | logical | | in | F | +!! | lradar | flag_for_radar_reflectivity | flag for radar reflectivity | flag | 0 | logical | | in | F | +!! | refl_10cm | radar_reflectivity_10cm | instantaneous refl_10cm | dBZ | 2 | real | kind_phys | inout | F | +!! | effr_in | flag_for_cloud_effective_radii | flag for cloud effective radii calculations in microphysics | | 0 | logical | | in | F | +!! | rew | effective_radius_of_stratiform_cloud_liquid_water_particle_in_um | eff. radius of cloud liquid water particle in micrometer | um | 2 | real | kind_phys | inout | F | +!! | rei | effective_radius_of_stratiform_cloud_ice_particle_in_um | eff. radius of cloud ice water particle in micrometer | um | 2 | real | kind_phys | inout | F | +!! | rer | effective_radius_of_stratiform_cloud_rain_particle_in_um | effective radius of cloud rain particle in micrometers | um | 2 | real | kind_phys | inout | F | +!! | res | effective_radius_of_stratiform_cloud_snow_particle_in_um | effective radius of cloud snow particle in micrometers | um | 2 | real | kind_phys | inout | F | +!! | reg | effective_radius_of_stratiform_cloud_graupel_particle_in_um | eff. radius of cloud graupel particle in micrometer | um | 2 | real | kind_phys | inout | F | +!! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | +!! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! subroutine gfdl_cloud_microphys_run( & levs, im, con_g, con_fvirt, con_rd, frland, garea, & gq0, gq0_ntcw, gq0_ntrw, gq0_ntiw, gq0_ntsw, gq0_ntgl, gq0_ntclamt, & gt0, gu0, gv0, vvl, prsl, phii, del, & rain0, ice0, snow0, graupel0, prcp0, sr, & - dtp, hydrostatic, phys_hydrostatic, errmsg, errflg) + dtp, hydrostatic, phys_hydrostatic, lradar, refl_10cm, & + effr_in, rew, rei, rer, res, reg, errmsg, errflg) use machine, only: kind_phys @@ -198,6 +210,11 @@ subroutine gfdl_cloud_microphys_run( & real(kind_phys), intent(in) :: dtp ! physics time step logical, intent (in) :: hydrostatic, phys_hydrostatic + logical, intent (in) :: lradar + real(kind=kind_phys), intent(inout), dimension(1:im,1:levs) :: refl_10cm + logical, intent (in) :: effr_in + real(kind=kind_phys), intent(inout), dimension(1:im,1:levs) :: rew, rei, rer, res, reg + character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -206,7 +223,8 @@ subroutine gfdl_cloud_microphys_run( & integer :: i, k, kk real(kind=kind_phys), dimension(1:im,1:levs) :: delp, dz, uin, vin, pt, qv1, ql1, qr1, qg1, qa1, qn1, qi1, & qs1, pt_dt, qa_dt, u_dt, v_dt, w, qv_dt, ql_dt, qr_dt, qi_dt, & - qs_dt, qg_dt + qs_dt, qg_dt, p123, refl + real(kind=kind_phys), dimension(:,:), allocatable :: den real(kind=kind_phys) :: onebg real(kind=kind_phys) :: tem @@ -255,6 +273,8 @@ subroutine gfdl_cloud_microphys_run( & vin(i,k) = gv0(i,kk) delp(i,k) = del(i,kk) dz(i,k) = (phii(i,kk)-phii(i,kk+1))*onebg + p123(i,k) = prsl(i,kk) + refl(i,k) = refl_10cm(i,kk) enddo enddo @@ -268,8 +288,7 @@ subroutine gfdl_cloud_microphys_run( & qv1, ql1, qr1, qi1, qs1, qg1, qa1, qn1, qv_dt, ql_dt, qr_dt, qi_dt, & qs_dt, qg_dt, qa_dt, pt_dt, pt, w, uin, vin, u_dt, v_dt, dz, delp, & garea, dtp, frland, rain0, snow0, ice0, graupel0, hydrostatic, & - phys_hydrostatic) - + phys_hydrostatic, p123, lradar, refl) tem = dtp*con_p001/con_day ! fix negative values @@ -311,7 +330,7 @@ subroutine gfdl_cloud_microphys_run( & graupel0 = graupel0*tem ! flip vertical coordinate back - do k = 1, levs + do k=1,levs kk = levs-k+1 do i=1,im gq0(i,k) = qv1(i,kk) + qv_dt(i,kk) * dtp @@ -324,9 +343,26 @@ subroutine gfdl_cloud_microphys_run( & gt0(i,k) = gt0(i,k) + pt_dt(i,kk) * dtp gu0(i,k) = gu0(i,k) + u_dt(i,kk) * dtp gv0(i,k) = gv0(i,k) + v_dt(i,kk) * dtp + refl_10cm(i,k) = refl(i,kk) enddo enddo + if(effr_in) then + allocate(den(1:im,1:levs)) + do k=1,levs + do i=1,im + den(i,k)=0.622*prsl(i,k)/(con_rd*gt0(i,k)*(gq0(i,k)+0.622)) + enddo + enddo + call cloud_diagnosis (1, im, 1, levs, den(1:im,1:levs), & + gq0_ntcw(1:im,1:levs), gq0_ntiw(1:im,1:levs), & + gq0_ntrw(1:im,1:levs), gq0_ntsw(1:im,1:levs), & + gq0_ntgl(1:im,1:levs), gt0(1:im,1:levs), & + rew(1:im,1:levs), rei(1:im,1:levs), rer(1:im,1:levs),& + res(1:im,1:levs), reg(1:im,1:levs)) + deallocate(den) + endif + end subroutine gfdl_cloud_microphys_run end module gfdl_cloud_microphys diff --git a/physics/gfdl_fv_sat_adj.F90 b/physics/gfdl_fv_sat_adj.F90 index 6c1564477..4bc8ba717 100644 --- a/physics/gfdl_fv_sat_adj.F90 +++ b/physics/gfdl_fv_sat_adj.F90 @@ -218,7 +218,7 @@ end subroutine fv_sat_adj_finalize !! | jsd | starting_y_direction_index_domain | starting X direction index for domain | count | 0 | integer | | in | F | !! | jed | ending_y_direction_index_domain | ending X direction index for domain | count | 0 | integer | | in | F | !! | ng | number_of_ghost_zones | number of ghost zones defined in fv_mp | count | 0 | integer | | in | F | -!! | hydrostatic | flag_for_hydrostatic_solver | flag for use the hydrostatic or nonhydrostatic solver | flag | 0 | logical | | in | F | +!! | hydrostatic | flag_for_hydrostatic_solver_for_fast_physics | flag for use the hydrostatic or nonhydrostatic solver | flag | 0 | logical | | in | F | !! | fast_mp_consv | flag_for_fast_microphysics_energy_conservation | flag for fast microphysics energy conservation | flag | 0 | logical | | in | F | !! | te0_2d | atmosphere_energy_content_in_column | atmosphere total energy in columns | J m-2 | 2 | real | kind_dyn | inout | F | !! | te0 | atmosphere_energy_content_at_Lagrangian_surface | atmosphere total energy at Lagrangian surface | J m-2 | 3 | real | kind_dyn | out | F | @@ -243,7 +243,7 @@ end subroutine fv_sat_adj_finalize !! | last_step | flag_for_the_last_step_of_k_split_remapping | flag for the last step of k-split remapping | flag | 0 | logical | | in | F | !! | do_qa | flag_for_inline_cloud_fraction_calculation | flag for the inline cloud fraction calculation | flag | 0 | logical | | in | F | !! | qa | cloud_fraction_at_Lagrangian_surface | cloud fraction at Lagrangian surface | none | 3 | real | kind_dyn | out | F | -!! | nthreads | omp_threads | number of OpenMP threads available for fast physics schemes | count | 0 | integer | | in | F | +!! | nthreads | omp_threads_for_fast_physics | number of OpenMP threads available for fast physics schemes | count | 0 | integer | | in | F | !! | errmsg | ccpp_error_message | error message for error handling in CCPP | none | 0 | character | len=* | out | F | !! | errflg | ccpp_error_flag | error flag for error handling in CCPP | flag | 0 | integer | | out | F | !! diff --git a/physics/module_gfdl_cloud_microphys.F90 b/physics/module_gfdl_cloud_microphys.F90 index 027158458..c3ab6acad 100644 --- a/physics/module_gfdl_cloud_microphys.F90 +++ b/physics/module_gfdl_cloud_microphys.F90 @@ -34,19 +34,24 @@ module gfdl_cloud_microphys_mod ! use fms_mod, only: write_version_number, open_namelist_file, & ! check_nml_error, file_exist, close_file + use module_mp_radar + implicit none private - public gfdl_cloud_microphys_mod_driver, gfdl_cloud_microphys_mod_init, gfdl_cloud_microphys_mod_end + public gfdl_cloud_microphys_mod_driver, gfdl_cloud_microphys_mod_init, & + gfdl_cloud_microphys_mod_end, cloud_diagnosis real :: missing_value = - 1.e10 - logical :: module_is_initialized = .false. - logical :: qsmith_tables_initialized = .false. + logical :: module_is_initialized = .false. + logical :: qsmith_tables_initialized = .false. character (len = 17) :: mod_name = 'gfdl_cloud_microphys' + real, parameter :: n0r = 8.0e6, n0s = 3.0e6, n0g = 4.0e6 + real, parameter :: rhos = 0.1e3, rhog = 0.4e3 real, parameter :: grav = 9.80665 !< gfs: acceleration due to gravity real, parameter :: rdgas = 287.05 !< gfs: gas constant for dry air real, parameter :: rvgas = 461.50 !< gfs: gas constant for water vapor @@ -146,8 +151,6 @@ module gfdl_cloud_microphys_mod ! logical :: master ! integer :: id_rh, id_vtr, id_vts, id_vtg, id_vti, id_rain, id_snow, id_graupel, & ! id_ice, id_prec, id_cond, id_var, id_droplets - ! integer :: gfdl_mp_clock ! clock for timing of driver routine - real, parameter :: dt_fr = 8. !< homogeneous freezing of all cloud water at t_wfr - dt_fr ! minimum temperature water can exist (moore & molinero nov. 2011, nature) ! dt_fr can be considered as the error bar @@ -315,11 +318,13 @@ module gfdl_cloud_microphys_mod ! ----------------------------------------------------------------------- !>\ingroup gfdlmp -subroutine gfdl_cloud_microphys_mod_driver (iis, iie, jjs, jje, kks, kke, ktop, kbot, & +subroutine gfdl_cloud_microphys_mod_driver ( & + iis, iie, jjs, jje, kks, kke, ktop, kbot, & qv, ql, qr, qi, qs, qg, qa, qn, & qv_dt, ql_dt, qr_dt, qi_dt, qs_dt, qg_dt, qa_dt, pt_dt, pt, w, & uin, vin, udt, vdt, dz, delp, area, dt_in, land, & - rain, snow, ice, graupel, hydrostatic, phys_hydrostatic) + rain, snow, ice, graupel, hydrostatic, phys_hydrostatic, & + p, lradar, refl_10cm) implicit none @@ -345,13 +350,18 @@ subroutine gfdl_cloud_microphys_mod_driver (iis, iie, jjs, jje, kks, kke, ktop, logical, intent (in) :: hydrostatic, phys_hydrostatic + !integer, intent (in) :: seconds + real, intent (in), dimension (iis:iie, jjs:jje, kks:kke) :: p + logical, intent (in) :: lradar + real, intent (out), dimension (iis:iie, jjs:jje, kks:kke) :: refl_10cm + ! Local variables real :: mpdt, rdt, dts, convt, tot_prec integer :: i, j, k integer :: is, ie, js, je ! physics window integer :: ks, ke ! vertical dimension - integer :: days, ntimes + integer :: days, ntimes, kflip real, dimension (iie-iis+1, jje-jjs+1) :: prec_mp, prec1, cond, w_var, rh0 @@ -360,6 +370,10 @@ subroutine gfdl_cloud_microphys_mod_driver (iis, iie, jjs, jje, kks, kke, ktop, real, dimension (size(pt,1), size(pt,3)) :: m2_rain, m2_sol real :: allmax +!+---+-----------------------------------------------------------------+ +!For 3D reflectivity calculations + real, dimension(ktop:kbot):: qv1d, t1d, p1d, qr1d, qs1d, qg1d, dBZ +!+---+-----------------------------------------------------------------+ is = 1 js = 1 @@ -367,7 +381,6 @@ subroutine gfdl_cloud_microphys_mod_driver (iis, iie, jjs, jje, kks, kke, ktop, ie = iie - iis + 1 je = jje - jjs + 1 ke = kke - kks + 1 - ! call mpp_clock_begin (gfdl_mp_clock) ! ----------------------------------------------------------------------- @@ -574,6 +587,27 @@ subroutine gfdl_cloud_microphys_mod_driver (iis, iie, jjs, jje, kks, kke, ktop, ! endif ! call mpp_clock_end (gfdl_mp_clock) + if(lradar) then + do j = js, je + do i = is, ie + do k = ktop,kbot + kflip = kbot-ktop+1-k+1 + t1d(k) = pt(i,j,kflip) + p1d(k) = p(i,j,kflip) + qv1d(k) = qv(i,j,kflip)/(1-qv(i,j,kflip)) + qr1d(k) = qr(i,j,kflip) + qs1d(k) = qs(i,j,kflip) + qg1d(k) = qg(i,j,kflip) + enddo + call refl10cm_gfdl (qv1d, qr1d, qs1d, qg1d, & + t1d, p1d, dBZ, ktop, kbot, i,j) + do k = ktop,kbot + kflip = kbot-ktop+1-k+1 + refl_10cm(i,j,kflip) = MAX(-35., dBZ(k)) + enddo + enddo + enddo + endif end subroutine gfdl_cloud_microphys_mod_driver @@ -3334,8 +3368,8 @@ subroutine setupm ! density parameters - real, parameter :: rhos = 0.1e3 !< lin83 (snow density; 1 / 10 of water) - real, parameter :: rhog = 0.4e3 !< rh84 (graupel density) +! real, parameter :: rhos = 0.1e3 !< lin83 (snow density; 1 / 10 of water) +! real, parameter :: rhog = 0.4e3 !< rh84 (graupel density) real, parameter :: acc (3) = (/ 5.0, 2.0, 0.5 /) real den_rc @@ -3570,10 +3604,25 @@ subroutine gfdl_cloud_microphys_mod_init (me, master, nlunit, input_nml_file, lo ! if (master) write (*, *) 'gfdl_cloud_micrphys diagnostics initialized.' - ! gfdl_mp_clock = mpp_clock_id ('gfdl_cloud_microphys', grain = clock_routine) - module_is_initialized = .true. +!+---+-----------------------------------------------------------------+ +!..Set these variables needed for computing radar reflectivity. These +!.. get used within radar_init to create other variables used in the +!.. radar module. + + xam_r = pi*rhor/6. + xbm_r = 3. + xmu_r = 0. + xam_s = pi*rhos/6. + xbm_s = 3. + xmu_s = 0. + xam_g = pi*rhog/6. + xbm_g = 3. + xmu_g = 0. + + call radar_init + end subroutine gfdl_cloud_microphys_mod_init ! ======================================================================= @@ -4663,16 +4712,18 @@ end subroutine interpolate_z ! ======================================================================= subroutine cloud_diagnosis (is, ie, js, je, den, qw, qi, qr, qs, qg, t, & - qcw, qci, qcr, qcs, qcg, rew, rei, rer, res, reg) + rew, rei, rer, res, reg) +! qcw, qci, qcr, qcs, qcg, rew, rei, rer, res, reg) implicit none integer, intent (in) :: is, ie, js, je real, intent (in), dimension (is:ie, js:je) :: den, t - real, intent (in), dimension (is:ie, js:je) :: qw, qi, qr, qs, qg ! units: kg / kg + real, intent (in), dimension (is:ie, js:je) :: qw, qi, qr, qs, qg ! units: kg / kg - real, intent (out), dimension (is:ie, js:je) :: qcw, qci, qcr, qcs, qcg ! units: kg / m^3 +! real, intent (out), dimension (is:ie, js:je) :: qcw, qci, qcr, qcs, qcg ! units: kg / m^3 + real, dimension (is:ie, js:je) :: qcw, qci, qcr, qcs, qcg ! units: kg / m^3 real, intent (out), dimension (is:ie, js:je) :: rew, rei, rer, res, reg ! units: micron integer :: i, j @@ -4683,7 +4734,11 @@ subroutine cloud_diagnosis (is, ie, js, je, den, qw, qi, qr, qs, qg, t, & real :: n0r = 8.0e6, n0s = 3.0e6, n0g = 4.0e6 real :: alphar = 0.8, alphas = 0.25, alphag = 0.5 real :: gammar = 17.837789, gammas = 8.2850630, gammag = 11.631769 - real :: qmin = 1.0e-5, ccn = 1.0e8, beta = 1.22 +! real :: qmin = 1.0e-5, ccn = 1.0e8, beta = 1.22 + real :: qmin = 5.0e-6, ccn = 1.0e8, beta = 1.22 +! real :: qmin = 1.0e-6, ccn = 1.0e8, beta = 1.22 +! real :: qmin = 1.0e-8, ccn = 1.0e8, beta = 1.22 +! real :: qmin = 1.0e-12, ccn = 1.0e8, beta = 1.22 ! real :: rewmin = 1.0, rewmax = 25.0 ! real :: reimin = 10.0, reimax = 300.0 @@ -4692,9 +4747,12 @@ subroutine cloud_diagnosis (is, ie, js, je, den, qw, qi, qr, qs, qg, t, & ! real :: regmin = 1000.0, regmax = 1.0e5 real :: rewmin = 5.0, rewmax = 10.0 real :: reimin = 10.0, reimax = 150.0 - real :: rermin = 0.0, rermax = 10000.0 - real :: resmin = 0.0, resmax = 10000.0 - real :: regmin = 0.0, regmax = 10000.0 +! real :: rermin = 0.0, rermax = 10000.0 +! real :: resmin = 0.0, resmax = 10000.0 +! real :: regmin = 0.0, regmax = 10000.0 + real :: rermin = 50.0, rermax = 10000.0 + real :: resmin = 100.0, resmax = 10000.0 + real :: regmin = 300.0, regmax = 10000.0 do j = js, je do i = is, ie @@ -4779,6 +4837,179 @@ subroutine cloud_diagnosis (is, ie, js, je, den, qw, qi, qr, qs, qg, t, & enddo end subroutine cloud_diagnosis + +!+---+-----------------------------------------------------------------+ + + subroutine refl10cm_gfdl (qv1d, qr1d, qs1d, qg1d, & + t1d, p1d, dBZ, kts, kte, ii,jj) + + IMPLICIT NONE + +!..Sub arguments + INTEGER, INTENT(IN):: kts, kte, ii,jj + REAL, DIMENSION(kts:kte), INTENT(IN):: & + qv1d, qr1d, qs1d, qg1d, t1d, p1d + REAL, DIMENSION(kts:kte), INTENT(INOUT):: dBZ + +!..Local variables + REAL, DIMENSION(kts:kte):: temp, pres, qv, rho + REAL, DIMENSION(kts:kte):: rr, rs, rg +! REAL:: temp_C + + DOUBLE PRECISION, DIMENSION(kts:kte):: ilamr, ilams, ilamg + DOUBLE PRECISION, DIMENSION(kts:kte):: N0_r, N0_s, N0_g + DOUBLE PRECISION:: lamr, lams, lamg + LOGICAL, DIMENSION(kts:kte):: L_qr, L_qs, L_qg + + REAL, DIMENSION(kts:kte):: ze_rain, ze_snow, ze_graupel + DOUBLE PRECISION:: fmelt_s, fmelt_g + + INTEGER:: i, k, k_0, kbot, n + LOGICAL:: melti + + DOUBLE PRECISION:: cback, x, eta, f_d +!+---+ + + do k = kts, kte + dBZ(k) = -35.0 + enddo + +!+---+-----------------------------------------------------------------+ +!..Put column of data into local arrays. +!+---+-----------------------------------------------------------------+ + do k = kts, kte + temp(k) = t1d(k) +! temp_C = min(-0.001, temp(K)-273.15) + qv(k) = MAX(1.E-10, qv1d(k)) + pres(k) = p1d(k) + rho(k) = 0.622*pres(k)/(rdgas*temp(k)*(qv(k)+0.622)) + + if (qr1d(k) .gt. 1.E-9) then + rr(k) = qr1d(k)*rho(k) + N0_r(k) = n0r + lamr = (xam_r*xcrg(3)*N0_r(k)/rr(k))**(1./xcre(1)) + ilamr(k) = 1./lamr + L_qr(k) = .true. + else + rr(k) = 1.E-12 + L_qr(k) = .false. + endif + + if (qs1d(k) .gt. 1.E-9) then + rs(k) = qs1d(k)*rho(k) + N0_s(k) = n0s + lams = (xam_s*xcsg(3)*N0_s(k)/rs(k))**(1./xcse(1)) + ilams(k) = 1./lams + L_qs(k) = .true. + else + rs(k) = 1.E-12 + L_qs(k) = .false. + endif + + if (qg1d(k) .gt. 1.E-9) then + rg(k) = qg1d(k)*rho(k) + N0_g(k) = n0g + lamg = (xam_g*xcgg(3)*N0_g(k)/rg(k))**(1./xcge(1)) + ilamg(k) = 1./lamg + L_qg(k) = .true. + else + rg(k) = 1.E-12 + L_qg(k) = .false. + endif + enddo + +!+---+-----------------------------------------------------------------+ +!..Locate K-level of start of melting (k_0 is level above). +!+---+-----------------------------------------------------------------+ + melti = .false. + k_0 = kts + do k = kte-1, kts, -1 + if ( (temp(k).gt.273.15) .and. L_qr(k) & + .and. (L_qs(k+1).or.L_qg(k+1)) ) then + k_0 = MAX(k+1, k_0) + melti=.true. + goto 195 + endif + enddo + 195 continue +!+---+-----------------------------------------------------------------+ +!..Assume Rayleigh approximation at 10 cm wavelength. Rain (all temps) +!.. and non-water-coated snow and graupel when below freezing are +!.. simple. Integrations of m(D)*m(D)*N(D)*dD. +!+---+-----------------------------------------------------------------+ + do k = kts, kte + ze_rain(k) = 1.e-22 + ze_snow(k) = 1.e-22 + ze_graupel(k) = 1.e-22 + if (L_qr(k)) ze_rain(k) = N0_r(k)*xcrg(4)*ilamr(k)**xcre(4) + if (L_qs(k)) ze_snow(k) = (0.176/0.93) * (6.0/PI)*(6.0/PI) & + * (xam_s/900.0)*(xam_s/900.0) & + * N0_s(k)*xcsg(4)*ilams(k)**xcse(4) + if (L_qg(k)) ze_graupel(k) = (0.176/0.93) * (6.0/PI)*(6.0/PI) & + * (xam_g/900.0)*(xam_g/900.0) & + * N0_g(k)*xcgg(4)*ilamg(k)**xcge(4) + enddo + + +!+---+-----------------------------------------------------------------+ +!..Special case of melting ice (snow/graupel) particles. Assume the +!.. ice is surrounded by the liquid water. Fraction of meltwater is +!.. extremely simple based on amount found above the melting level. +!.. Uses code from Uli Blahak (rayleigh_soak_wetgraupel and supporting +!.. routines). +!+---+-----------------------------------------------------------------+ + + if (melti .and. k_0.ge.kts+1) then + do k = k_0-1, kts, -1 + +!..Reflectivity contributed by melting snow + if (L_qs(k) .and. L_qs(k_0) ) then + fmelt_s = MAX(0.005d0, MIN(1.0d0-rs(k)/rs(k_0), 0.99d0)) + eta = 0.d0 + lams = 1./ilams(k) + do n = 1, nrbins + x = xam_s * xxDs(n)**xbm_s + call rayleigh_soak_wetgraupel (x,DBLE(xocms),DBLE(xobms), & + fmelt_s, melt_outside_s, m_w_0, m_i_0, lamda_radar, & + CBACK, mixingrulestring_s, matrixstring_s, & + inclusionstring_s, hoststring_s, & + hostmatrixstring_s, hostinclusionstring_s) + f_d = N0_s(k)*xxDs(n)**xmu_s * DEXP(-lams*xxDs(n)) + eta = eta + f_d * CBACK * simpson(n) * xdts(n) + enddo + ze_snow(k) = SNGL(lamda4 / (pi5 * K_w) * eta) + endif + + +!..Reflectivity contributed by melting graupel + + if (L_qg(k) .and. L_qg(k_0) ) then + fmelt_g = MAX(0.005d0, MIN(1.0d0-rg(k)/rg(k_0), 0.99d0)) + eta = 0.d0 + lamg = 1./ilamg(k) + do n = 1, nrbins + x = xam_g * xxDg(n)**xbm_g + call rayleigh_soak_wetgraupel (x,DBLE(xocmg),DBLE(xobmg), & + fmelt_g, melt_outside_g, m_w_0, m_i_0, lamda_radar, & + CBACK, mixingrulestring_g, matrixstring_g, & + inclusionstring_g, hoststring_g, & + hostmatrixstring_g, hostinclusionstring_g) + f_d = N0_g(k)*xxDg(n)**xmu_g * DEXP(-lamg*xxDg(n)) + eta = eta + f_d * CBACK * simpson(n) * xdtg(n) + enddo + ze_graupel(k) = SNGL(lamda4 / (pi5 * K_w) * eta) + endif + + enddo + endif + + do k = kte, kts, -1 + dBZ(k) = 10.*log10((ze_rain(k)+ze_snow(k)+ze_graupel(k))*1.d18) + enddo + + + end subroutine refl10cm_gfdl +!+---+-----------------------------------------------------------------+ !! @} !! @} diff --git a/physics/module_mp_thompson_hrrr_radar.F90 b/physics/module_mp_radar.F90 similarity index 99% rename from physics/module_mp_thompson_hrrr_radar.F90 rename to physics/module_mp_radar.F90 index 98f5f3e78..cbd17c1f2 100644 --- a/physics/module_mp_thompson_hrrr_radar.F90 +++ b/physics/module_mp_radar.F90 @@ -20,7 +20,7 @@ !.. calculations based on 50 individual size bins of the distributions. !+---+-----------------------------------------------------------------+ - MODULE module_mp_thompson_hrrr_radar + MODULE module_mp_radar PUBLIC :: rayleigh_soak_wetgraupel PUBLIC :: radar_init @@ -608,5 +608,5 @@ REAL FUNCTION WGAMMA(y) END FUNCTION WGAMMA !+---+-----------------------------------------------------------------+ - END MODULE module_mp_thompson_hrrr_radar + END MODULE module_mp_radar !+---+-----------------------------------------------------------------+ diff --git a/physics/module_mp_thompson_hrrr.F90 b/physics/module_mp_thompson_hrrr.F90 index 74b2079e1..f2b3e2869 100644 --- a/physics/module_mp_thompson_hrrr.F90 +++ b/physics/module_mp_thompson_hrrr.F90 @@ -48,9 +48,9 @@ ! MODULE module_mp_thompson_hrrr - USE machine, ONLY : kind_phys + USE machine, only : kind_phys - USE module_mp_thompson_hrrr_radar + USE module_mp_radar IMPLICIT NONE diff --git a/physics/samfdeepcnv.f b/physics/samfdeepcnv.f index 933b55567..33e349bad 100755 --- a/physics/samfdeepcnv.f +++ b/physics/samfdeepcnv.f @@ -77,6 +77,8 @@ end subroutine samfdeepcnv_finalize !! | t1 | air_temperature_updated_by_physics | updated temperature | K | 2 | real | kind_phys | inout | F | !! | u1 | x_wind_updated_by_physics | updated x-direction wind | m s-1 | 2 | real | kind_phys | inout | F | !! | v1 | y_wind_updated_by_physics | updated y-direction wind | m s-1 | 2 | real | kind_phys | inout | F | +!! | do_ca | flag_for_cellular_automata | cellular automata main switch | flag | 0 | logical | | in | F | +!! | ca_deep | fraction_of_cellular_automata_for_deep_convection | fraction of cellular automata for deep convection | frac | 1 | real | kind_phys | in | F | !! | cldwrk | cloud_work_function | cloud work function | m2 s-2 | 1 | real | kind_phys | out | F | !! | rn | lwe_thickness_of_deep_convective_precipitation_amount | deep convective rainfall amount on physics timestep | m | 1 | real | kind_phys | out | F | !! | kbot | vertical_index_at_cloud_base | index for cloud base | index | 1 | integer | | out | F | @@ -134,7 +136,7 @@ subroutine samfdeepcnv_run (im,ix,km,cliq,cp,cvap, & & eps,epsm1,fv,grav,hvap,rd,rv, & & t0c,delt,ntk,ntr,delp, & & prslp,psp,phil,qtr,q1,t1,u1,v1, & - & cldwrk,rn,kbot,ktop,kcnv,islimsk,garea, & + & do_ca,ca_deep,cldwrk,rn,kbot,ktop,kcnv,islimsk,garea, & & dot,ncloud,ud_mf,dd_mf,dt_mf,cnvw,cnvc, & & QLCN, QICN, w_upi, cf_upi, CNV_MFD, & & CNV_DQLDT,CLCN,CNV_FICE,CNV_NDROP,CNV_NICE,mp_phys,mp_phys_mg,& @@ -153,6 +155,8 @@ subroutine samfdeepcnv_run (im,ix,km,cliq,cp,cvap, & real(kind=kind_phys), intent(in) :: delt real(kind=kind_phys), intent(in) :: psp(im), delp(ix,km), & prslp(ix,km), garea(im), dot(ix,km), phil(ix,km) + real(kind=kind_phys), intent(in) :: ca_deep(ix) + logical, intent(in) :: do_ca integer, intent(inout) :: kcnv(im) real(kind=kind_phys), intent(inout) :: qtr(ix,km,ntr+2), diff --git a/physics/sfc_drv.f b/physics/sfc_drv.f index f2770cb8f..6cc5155e6 100644 --- a/physics/sfc_drv.f +++ b/physics/sfc_drv.f @@ -74,7 +74,7 @@ end subroutine lsm_noah_finalize ! sfcemis, dlwflx, dswsfc, snet, delt, tg3, cm, ch, ! ! prsl1, prslki, zf, islimsk, ddvel, slopetyp, ! ! shdmin, shdmax, snoalb, sfalb, flag_iter, flag_guess, ! -! isot, ivegsrc, ! +! lheatstrg, isot, ivegsrc, ! ! --- in/outs: ! ! weasd, snwdph, tskin, tprcp, srflag, smc, stc, slc, ! ! canopy, trans, tsurf, zorl, ! @@ -128,6 +128,8 @@ end subroutine lsm_noah_finalize ! sfalb - real, mean sfc diffused sw albedo (fractional) im ! ! flag_iter- logical, im ! ! flag_guess-logical, im ! +! lheatstrg- logical, flag for canopy heat storage 1 ! +! parameterization ! ! isot - integer, sfc soil type data source zobler or statsgo ! ! ivegsrc - integer, sfc veg type data source umd or igbp ! ! ! @@ -207,6 +209,7 @@ end subroutine lsm_noah_finalize !! | sfalb | surface_diffused_shortwave_albedo | mean surface diffused shortwave albedo | frac | 1 | real | kind_phys | in | F | !! | flag_iter | flag_for_iteration | flag for iteration | flag | 1 | logical | | in | F | !! | flag_guess | flag_for_guess_run | flag for guess run | flag | 1 | logical | | in | F | +!! | lheatstrg | flag_for_canopy_heat_storage | flag for canopy heat storage parameterization | flag | 0 | logical | | in | F | !! | isot | soil_type_dataset_choice | soil type dataset choice | index | 0 | integer | | in | F | !! | ivegsrc | vegetation_type_dataset_choice | land use dataset choice | index | 0 | integer | | in | F | !! | bexppert | perturbation_of_soil_type_b_parameter | perturbation of soil type "b" parameter | frac | 1 | real | kind_phys | in | F | @@ -249,20 +252,23 @@ end subroutine lsm_noah_finalize !! !> \section general_noah_drv GFS sfc_drv General Algorithm !! @{ - subroutine lsm_noah_run & + subroutine lsm_noah_run & +! --- inputs: & ( im, km, ps, u1, v1, t1, q1, soiltyp, vegtype, sigmaf, & & sfcemis, dlwflx, dswsfc, snet, delt, tg3, cm, ch, & & prsl1, prslki, zf, islimsk, ddvel, slopetyp, & & shdmin, shdmax, snoalb, sfalb, flag_iter, flag_guess, & - & isot, ivegsrc, & ! --- inputs from here and above + & lheatstrg, isot, ivegsrc, & & bexppert, xlaipert, vegfpert,pertvegf, & ! sfc perts, mgehne +! --- in/outs: & weasd, snwdph, tskin, tprcp, srflag, smc, stc, slc, & - & canopy, trans, tsurf, zorl, & ! --- in/outs from here and above + & canopy, trans, tsurf, zorl, & +! --- outputs: & sncovr1, qsurf, gflux, drain, evap, hflx, ep, runoff, & & cmm, chh, evbs, evcw, sbsno, snowc, stm, snohf, & - & smcwlt2, smcref2, wet1, errmsg, errflg & ! -- outputs from here and above + & smcwlt2, smcref2, wet1, errmsg, errflg & & ) - +! use machine , only : kind_phys use funcphys, only : fpvs use physcons, only : grav => con_g, cp => con_cp, & @@ -270,8 +276,7 @@ subroutine lsm_noah_run & & eps => con_eps, epsm1 => con_epsm1, & & rvrdm1 => con_fvirt -! use module_radiation_surface, only : ppfbet ! comment out and put the function instance inside lsm_noah module - use surface_perturbation, only : ppfbet ! comment out and put the function instance inside lsm_noah module + use surface_perturbation, only : ppfbet implicit none @@ -290,7 +295,6 @@ subroutine lsm_noah_run & ! --- input: integer, intent(in) :: im, km, isot, ivegsrc -! real (kind=kind_phys), dimension(6), intent(in) :: pertvegf real (kind=kind_phys), dimension(5), intent(in) :: pertvegf integer, dimension(im), intent(in) :: soiltyp, vegtype, slopetyp @@ -306,6 +310,8 @@ subroutine lsm_noah_run & logical, dimension(im), intent(in) :: flag_iter, flag_guess + logical, intent(in) :: lheatstrg + ! --- in/out: real (kind=kind_phys), dimension(im), intent(inout) :: weasd, & & snwdph, tskin, tprcp, srflag, canopy, trans, tsurf, zorl @@ -341,7 +347,7 @@ subroutine lsm_noah_run & & sfcems, sheat, shdfac, shdmin1d, shdmax1d, smcwlt, & & smcdry, smcref, smcmax, sneqv, snoalb1d, snowh, & & snomlt, sncovr, soilw, soilm, ssoil, tsea, th2, tbot, & - & xlai, zlvl, swdn, tem,z0, bexpp, xlaip, vegfp, & + & xlai, zlvl, swdn, tem, z0, bexpp, xlaip, vegfp, & & mv,sv,alphav,betav,vegftmp integer :: couple, ice, nsoil, nroot, slope, stype, vtype @@ -441,12 +447,13 @@ subroutine lsm_noah_run & ! sldpth the thickness of each soil layer (\f$m\f$) couple = 1 ! run noah lsm in 'couple' mode - - if (srflag(i) == 1.0) then ! snow phase - ffrozp = 1.0 - elseif (srflag(i) == 0.0) then ! rain phase - ffrozp = 0.0 - endif +! use srflag directly to allow fractional rain/snow +! if (srflag(i) == 1.0) then ! snow phase +! ffrozp = 1.0 +! elseif (srflag(i) == 0.0) then ! rain phase +! ffrozp = 0.0 +! endif + ffrozp = srflag(i) ice = 0 zlvl = zf(i) @@ -583,6 +590,7 @@ subroutine lsm_noah_run & & sfcspd, prcp, q2, q2sat, dqsdt2, th2, ivegsrc, & & vtype, stype, slope, shdmin1d, alb, snoalb1d, & & bexpp, xlaip, & ! sfc-perts, mgehne + & lheatstrg, & ! --- input/outputs: & tbot, cmc, tsea, stsoil, smsoil, slsoil, sneqv, chx, cmx, & & z0, & diff --git a/physics/sfc_sice.f b/physics/sfc_sice.f index 83ab2ef4d..bc171cdf3 100644 --- a/physics/sfc_sice.f +++ b/physics/sfc_sice.f @@ -156,12 +156,15 @@ end subroutine sfc_sice_finalize !> \section detailed_sice_run GFS Sea Ice Driver Detailed Algorithm !! @{ subroutine sfc_sice_run & +! --- inputs: & ( im, km, ps, u1, v1, t1, q1, delt, & & sfcemis, dlwflx, sfcnsw, sfcdsw, srflag, & & cm, ch, prsl1, prslki, islimsk, ddvel, & - & flag_iter, mom4ice, lsm, lprnt, ipr, & ! -- inputs from here and above - & hice, fice, tice, weasd, tskin, tprcp, stc, ep, & ! -- in/outs - & snwdph, qsurf, snowmt, gflux, cmm, chh, evap, hflx, & ! -- outputs + & flag_iter, mom4ice, lsm, lprnt, ipr, & +! --- input/outputs: + & hice, fice, tice, weasd, tskin, tprcp, stc, ep, & +! --- outputs: + & snwdph, qsurf, snowmt, gflux, cmm, chh, evap, hflx, & & errmsg, errflg & ) @@ -213,7 +216,7 @@ subroutine sfc_sice_run & ! dlwflx - real, total sky sfc downward lw flux ( w/m**2 ) im ! ! sfcnsw - real, total sky sfc netsw flx into ground(w/m**2) im ! ! sfcdsw - real, total sky sfc downward sw flux ( w/m**2 ) im ! -! srflag - real, snow/rain flag for precipitation im ! +! srflag - real, snow/rain fraction for precipitation im ! ! cm - real, surface exchange coeff for momentum (m/s) im ! ! ch - real, surface exchange coeff heat & moisture(m/s) im ! ! prsl1 - real, surface layer mean pressure im ! @@ -346,10 +349,10 @@ subroutine sfc_sice_run & elseif (lsm > 0) then ! --- ... snow-rain detection do i = 1, im if (flag(i)) then - if (srflag(i) == 1.0) then - ep(i) = 0.0 - weasd(i) = weasd(i) + 1.e3*tprcp(i) - tprcp(i) = 0.0 + if (srflag(i) > 0) then + ep(i) = ep(i)*(1.-srflag(i)) + weasd(i) = weasd(i) + 1.e3*tprcp(i)*srflag(i) + tprcp(i) = tprcp(i)*(1.-srflag(i)) endif endif enddo diff --git a/physics/sfcsub.F b/physics/sfcsub.F index 8c49f0a1f..916ff4e48 100644 --- a/physics/sfcsub.F +++ b/physics/sfcsub.F @@ -35,15 +35,17 @@ subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc &, swdfcs,slcfcs &, vmnfcs,vmxfcs,slpfcs,absfcs &, tsffcs,snofcs,zorfcs,albfcs,tg3fcs - &, cnpfcs,smcfcs,stcfcs,slifcs,aisfcs,f10m + &, cnpfcs,smcfcs,stcfcs,slifcs,aisfcs &, vegfcs,vetfcs,sotfcs,alffcs &, cvfcs,cvbfcs,cvtfcs,me,nlunit &, sz_nml,input_nml_file - &, ialb,isot,ivegsrc) + &, ialb,isot,ivegsrc,tile_num_ch,i_index,j_index) ! use machine , only : kind_io8,kind_io4 use sfccyc_module implicit none + character(len=*), intent(in) :: tile_num_ch + integer,intent(in) :: i_index(len), j_index(len) logical use_ufo, nst_anl real (kind=kind_io8) sllnd,slsea,aicice,aicsea,tgice,rlapse, & orolmx,orolmn,oroomx,oroomn,orosmx, @@ -1060,7 +1062,7 @@ subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc & kpdvmn,kpdvmx,kpdslp,kpdabs, & deltsfc, lanom &, imsk, jmsk, slmskh, rla, rlo, gausm, blnmsk, bltmsk,me - &, lprnt, iprnt, fnalbc2, ialb) + &, lprnt,iprnt,fnalbc2,ialb,tile_num_ch,i_index,j_index) ! if(lprnt) print *,'tsfclm=',tsfclm(iprnt),' tsfcl2=',tsfcl2(iprnt) ! ! scale surface roughness and albedo to model required units @@ -1798,9 +1800,16 @@ subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc ! make reverse orography correction to tg3 ! if (use_ufo) then - ztsfc = 1.0 orogd = orog - orog_uf - call tsfcor(tg3fcs,orogd,slmask,ztsfc,len,-rlapse) +! +! The tiled version of the substrate temperature is properly +! adjusted to the terrain. Only invoke when using the old +! global tg3 grib file. +! + if ( index(fntg3c, "tileX.nc") == 0) then ! global file + ztsfc = 1.0 + call tsfcor(tg3fcs,orogd,slmask,ztsfc,len,-rlapse) + endif ztsfc = 0. call tsfcor(tsffcs,orogd,slmask,ztsfc,len,-rlapse) else @@ -2199,8 +2208,15 @@ subroutine sfccycle(lugb,len,lsoil,sig1t,deltsfc ! ! if(lprnt) print *,' tsfbc=',tsfanl(iprnt) if (use_ufo) then - ztsfc = 1. - call tsfcor(tg3anl,orogd,slmask,ztsfc,len,rlapse) +! +! The tiled version of the substrate temperature is properly +! adjusted to the terrain. Only invoke when using the old +! global tg3 grib file. +! + if ( index(fntg3c, "tileX.nc") == 0) then ! global file + ztsfc = 1. + call tsfcor(tg3anl,orogd,slmask,ztsfc,len,rlapse) + endif ztsfc = 0. call tsfcor(tsfanl,orogd,slmask,ztsfc,len,rlapse) else @@ -6805,10 +6821,13 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, & kpdvmn,kpdvmx,kpdslp,kpdabs, & deltsfc, lanom &, imsk, jmsk, slmskh, outlat, outlon - &, gaus, blno, blto, me,lprnt,iprnt, fnalbc2, ialb) + &, gaus, blno, blto, me,lprnt,iprnt, fnalbc2, ialb + &, tile_num_ch, i_index, j_index) ! use machine , only : kind_io8,kind_io4 implicit none + character(len=*), intent(in) :: tile_num_ch + integer, intent(in) :: i_index(len), j_index(len) real (kind=kind_io8) rjday,wei1x,wei2x,rjdayh,wei2m,wei1m,wei1s, & wei2s,fh,stcmon1s,blto,blno,deltsfc,rjdayh2 real (kind=kind_io8) wei1y,wei2y @@ -7147,11 +7166,15 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, if (ialb == 1) then !cbosu still need facsf and facwf. read them from the production !cbosu file -!cbosu - call fixrdc(lugb,fnalbc2,kpdalf(1),kpd7,kpd9,slmask - &, alf,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnalbc2, "tileX.nc") == 0) then ! grib file + call fixrdc(lugb,fnalbc2,kpdalf(1),kpd7,kpd9,slmask + &, alf,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnalbc2, tile_num_ch, i_index, j_index, + & kpdalf(1), alf(:,1), 1, len, me) + endif else call fixrdc(lugb,fnalbc,kpdalf(1),kpd7,kpd9,slmask &, alf,len,iret @@ -7167,11 +7190,16 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! deep soil temperature ! if(fntg3c(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fntg3c,kpdtg3,kpd7,kpd9,slmask, - & tg3,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fntg3c, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fntg3c,kpdtg3,kpd7,kpd9,slmask, + & tg3,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fntg3c, tile_num_ch, i_index, j_index, + & kpdtg3, tg3, 1, len, me) + endif endif ! ! vegetation type @@ -7180,15 +7208,21 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! dataset must be selected. ! if(fnvetc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnvetc,kpdvet,kpd7,kpd9,slmask, - & vet,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnvetc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnvetc,kpdvet,kpd7,kpd9,slmask, + & vet,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + landice_cat=13 + if (maxval(vet)> 13.0) landice_cat=15 + else + call fixrdc_tile(fnvetc, tile_num_ch, i_index, j_index, + & kpdvet, vet, 1, len, me) + landice_cat=15 + endif if (me .eq. 0) write(6,*) 'climatological vegetation', & ' type read in.' - landice_cat=13 - if (maxval(vet)> 13.0) landice_cat=15 elseif(index(fnsmcc,'soilmgldas') /= 0) then ! new soil moisture climo if (me .eq. 0) write(6,*) 'fatal error: must choose' if (me .eq. 0) write(6,*) 'climatological veg type when' @@ -7199,11 +7233,16 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! soil type ! if(fnsotc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnsotc,kpdsot,kpd7,kpd9,slmask, - & sot,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnsotc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnsotc,kpdsot,kpd7,kpd9,slmask, + & sot,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnsotc, tile_num_ch, i_index, j_index, + & kpdsot, sot, 1, len, me) + endif if (me .eq. 0) write(6,*) 'climatological soil type read in.' endif @@ -7211,44 +7250,65 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! min vegetation cover ! if(fnvmnc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnvmnc,kpdvmn,kpd7,kpd9,slmask, - & vmn,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnvmnc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnvmnc,kpdvmn,kpd7,kpd9,slmask, + & vmn,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnvmnc, tile_num_ch, i_index, j_index, + & 257, vmn, 99, len, me) + + endif if (me .eq. 0) write(6,*) 'climatological shdmin read in.' endif ! ! max vegetation cover ! if(fnvmxc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnvmxc,kpdvmx,kpd7,kpd9,slmask, - & vmx,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnvmxc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnvmxc,kpdvmx,kpd7,kpd9,slmask, + & vmx,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnvmxc, tile_num_ch, i_index, j_index, + & 256, vmx, 99, len, me) + endif if (me .eq. 0) write(6,*) 'climatological shdmax read in.' endif ! ! slope type ! if(fnslpc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnslpc,kpdslp,kpd7,kpd9,slmask, - & slp,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnslpc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnslpc,kpdslp,kpd7,kpd9,slmask, + & slp,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnslpc, tile_num_ch, i_index, j_index, + & kpdslp, slp, 1, len, me) + endif if (me .eq. 0) write(6,*) 'climatological slope read in.' endif ! ! max snow albeod ! if(fnabsc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnabsc,kpdabs,kpd7,kpd9,slmask, - & absm,len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnabsc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnabsc,kpdabs,kpd7,kpd9,slmask, + & absm,len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnabsc, tile_num_ch, i_index, j_index, + & kpdabs, absm, 1, len, me) + endif if (me .eq. 0) write(6,*) 'climatological snoalb read in.' endif !clu ---------------------------------------------------------------------- @@ -7294,13 +7354,20 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, !cbosu !cbosu new snowfree albedo database is monthly. if (ialb == 1) then - kpd7=-1 - do k = 1, 4 - call fixrdc(lugb,fnalbc,kpdalb(k),kpd7,mon,slmask, - & alb(1,k,nn),len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) - enddo + if ( index(fnalbc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + do k = 1, 4 + call fixrdc(lugb,fnalbc,kpdalb(k),kpd7,mon,slmask, + & alb(1,k,nn),len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + enddo + else + do k = 1, 4 + call fixrdc_tile(fnalbc, tile_num_ch, i_index, j_index, + & kpdalb(k), alb(:,k,nn), mon, len, me) + enddo + endif endif ! if(lprnt) print *,' mon1=',mon1,' mon2=',mon2 @@ -7458,11 +7525,16 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! vegetation cover ! if(fnvegc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnvegc,kpdveg,kpd7,mon,slmask, - & veg(1,nn),len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnvegc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnvegc,kpdveg,kpd7,mon,slmask, + & veg(1,nn),len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnvegc, tile_num_ch, i_index, j_index, + & kpdveg, veg(:,nn), mon, len, me) + endif if (me .eq. 0) write(6,*) 'climatological vegetation', & ' cover read in for mon=',mon endif @@ -7568,13 +7640,20 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, if (ialb == 1) then if (me == 0) print*,'bosu 2nd time in clima for month ', & mon, k1,k2 - kpd7=-1 - do k = 1, 4 - call fixrdc(lugb,fnalbc,kpdalb(k),kpd7,mon,slmask, - & alb(1,k,nn),len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) - enddo + if ( index(fnalbc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + do k = 1, 4 + call fixrdc(lugb,fnalbc,kpdalb(k),kpd7,mon,slmask, + & alb(1,k,nn),len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + enddo + else + do k = 1, 4 + call fixrdc_tile(fnalbc, tile_num_ch, i_index, j_index, + & kpdalb(k), alb(:,k,nn), mon, len, me) + enddo + endif endif ! ! tsf at the current time t @@ -7691,11 +7770,16 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! vegetation cover ! if(fnvegc(1:8).ne.' ') then - kpd7=-1 - call fixrdc(lugb,fnvegc,kpdveg,kpd7,mon,slmask, - & veg(1,nn),len,iret - &, imsk, jmsk, slmskh, gaus,blno, blto - &, outlat, outlon, me) + if ( index(fnvegc, "tileX.nc") == 0) then ! grib file + kpd7=-1 + call fixrdc(lugb,fnvegc,kpdveg,kpd7,mon,slmask, + & veg(1,nn),len,iret + &, imsk, jmsk, slmskh, gaus,blno, blto + &, outlat, outlon, me) + else + call fixrdc_tile(fnvegc, tile_num_ch, i_index, j_index, + & kpdveg, veg(:,nn), mon, len, me) + endif ! if (me .eq. 0) write(6,*) 'climatological vegetation', ! & ' cover read in for mon=',mon endif @@ -7887,6 +7971,156 @@ subroutine clima(lugb,iy,im,id,ih,fh,len,lsoil, ! return end subroutine clima + subroutine fixrdc_tile(filename_raw, tile_num_ch, + & i_index, j_index, kpds, + & var, mon, npts, me) + use netcdf + use machine , only : kind_io8 + implicit none + character(len=*), intent(in) :: filename_raw + character(len=*), intent(in) :: tile_num_ch + integer, intent(in) :: npts, me, kpds, mon + integer, intent(in) :: i_index(npts) + integer, intent(in) :: j_index(npts) + real(kind_io8), intent(out) :: var(npts) + character(len=500) :: filename + character(len=80) :: errmsg + integer :: i, ii, ncid, t + integer :: error, id_dim + integer :: nx, ny, num_times + integer :: id_var + real(kind=4), allocatable :: dummy(:,:,:) + ii=index(filename_raw,"tileX") + + do i = 1, len(filename) + filename(i:i) = " " + enddo + + filename = filename_raw(1:ii-1) // tile_num_ch // ".nc" + + if (me == 0) print*, ' in fixrdc_tile for mon=',mon, + & ' filename=', trim(filename) + + error=nf90_open(trim(filename), nf90_nowrite, ncid) + if (error /= nf90_noerr) call netcdf_err(error) + + error=nf90_inq_dimid(ncid, 'nx', id_dim) + if (error /= nf90_noerr) call netcdf_err(error) + error=nf90_inquire_dimension(ncid,id_dim,len=nx) + if (error /= nf90_noerr) call netcdf_err(error) + + error=nf90_inq_dimid(ncid, 'ny', id_dim) + if (error /= nf90_noerr) call netcdf_err(error) + error=nf90_inquire_dimension(ncid,id_dim,len=ny) + if (error /= nf90_noerr) call netcdf_err(error) + + error=nf90_inq_dimid(ncid, 'time', id_dim) + if (error /= nf90_noerr) call netcdf_err(error) + error=nf90_inquire_dimension(ncid,id_dim,len=num_times) + if (error /= nf90_noerr) call netcdf_err(error) + + select case (kpds) + case(11) + error=nf90_inq_varid(ncid, 'substrate_temperature', id_var) + case(87) + error=nf90_inq_varid(ncid, 'vegetation_greenness', id_var) + case(159) + error=nf90_inq_varid(ncid, 'maximum_snow_albedo', id_var) + case(189) + error=nf90_inq_varid(ncid, 'visible_black_sky_albedo', id_var) + case(190) + error=nf90_inq_varid(ncid, 'visible_white_sky_albedo', id_var) + case(191) + error=nf90_inq_varid(ncid, 'near_IR_black_sky_albedo', id_var) + case(192) + error=nf90_inq_varid(ncid, 'near_IR_white_sky_albedo', id_var) + case(214) + error=nf90_inq_varid(ncid, 'facsf', id_var) + case(224) + error=nf90_inq_varid(ncid, 'soil_type', id_var) + case(225) + error=nf90_inq_varid(ncid, 'vegetation_type', id_var) + case(236) + error=nf90_inq_varid(ncid, 'slope_type', id_var) + case(256:257) + error=nf90_inq_varid(ncid, 'vegetation_greenness', id_var) + case default + print*,'fatal error in fixrdc_tile of sfcsub.F.' + print*,'unknown variable.' + call abort + end select + if (error /= nf90_noerr) call netcdf_err(error) + + allocate(dummy(nx,ny,1)) + + if (kpds == 256) then ! max veg greenness + + var = -9999. + do t = 1, num_times + error=nf90_get_var(ncid, id_var, dummy, start=(/1,1,t/), + & count=(/nx,ny,1/) ) + if (error /= nf90_noerr) call netcdf_err(error) + do ii = 1,npts + var(ii) = max(var(ii), dummy(i_index(ii),j_index(ii),1)) + enddo + enddo + + elseif (kpds == 257) then ! min veg greenness + + var = 9999. + do t = 1, num_times + error=nf90_get_var(ncid, id_var, dummy, start=(/1,1,t/), + & count=(/nx,ny,1/) ) + if (error /= nf90_noerr) call netcdf_err(error) + do ii = 1, npts + var(ii) = min(var(ii), dummy(i_index(ii),j_index(ii),1)) + enddo + enddo + + else + + error=nf90_get_var(ncid, id_var, dummy, start=(/1,1,mon/), + & count=(/nx,ny,1/) ) + if (error /= nf90_noerr) call netcdf_err(error) + + do ii = 1, npts + var(ii) = dummy(i_index(ii),j_index(ii),1) + enddo + + endif + + deallocate(dummy) + + error=nf90_close(ncid) + + select case (kpds) + case(159) ! max snow alb + var = var * 100.0 + case(214) ! facsf + where (var < 0.0) var = 0.0 + var = var * 100.0 + case(189:192) + var = var * 100.0 + case(256:257) + var = var * 100.0 + end select + + return + + end subroutine fixrdc_tile + subroutine netcdf_err(error) + + use netcdf + implicit none + + integer,intent(in) :: error + character(len=256) :: errmsg + + errmsg = nf90_strerror(error) + print*,'fatal error in sfcsub.F: ', trim(errmsg) + call abort + + end subroutine netcdf_err subroutine fixrdc(lugb,fngrib,kpds5,kpds7,mon,slmask, & gdata,len,iret &, imsk, jmsk, slmskh, gaus,blno, blto diff --git a/physics/sflx.f b/physics/sflx.f index 4078c275c..bc571aeba 100644 --- a/physics/sflx.f +++ b/physics/sflx.f @@ -110,14 +110,18 @@ !!\param[out] smcmax real, porosity (sat val of soil mois) !>\section general_sflx GFS Noah LSM General Algorithm !! @{ - subroutine gfssflx & ! --- inputs: + subroutine gfssflx & +! --- inputs: & ( nsoil, couple, icein, ffrozp, dt, zlvl, sldpth, & & swdn, swnet, lwdn, sfcems, sfcprs, sfctmp, & & sfcspd, prcp, q2, q2sat, dqsdt2, th2, ivegsrc, & & vegtyp, soiltyp, slopetyp, shdmin, alb, snoalb, & - & bexpp, xlaip, & - & tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm,z0, & ! --- input/outputs: - & nroot, shdfac, snowh, albedo, eta, sheat, ec, & ! --- outputs: + & bexpp, xlaip, & ! sfc-perts, mgehne + & lheatstrg, & +! --- input/outputs: + & tbot, cmc, t1, stc, smc, sh2o, sneqv, ch, cm,z0, & +! --- outputs: + & nroot, shdfac, snowh, albedo, eta, sheat, ec, & & edir, et, ett, esnow, drip, dew, beta, etp, ssoil, & & flx1, flx2, flx3, runoff1, runoff2, runoff3, & & snomlt, sncovr, rc, pc, rsmin, xlai, rcs, rct, rcq, & @@ -170,6 +174,7 @@ subroutine gfssflx & ! --- inpu ! consolidated constents/parameters by using ! ! module physcons, and added program documentation! ! sep 2009 -- s. moorthi minor fixes ! +! nov 2018 -- j. han add canopy heat storage parameterization ! ! ! ! ==================== defination of variables ==================== ! ! ! @@ -178,7 +183,7 @@ subroutine gfssflx & ! --- inpu ! couple - integer, =0:uncoupled (land model only) 1 ! ! =1:coupled with parent atmos model ! ! icein - integer, sea-ice flag (=1: sea-ice, =0: land) 1 ! -! ffrozp - real, 1 ! +! ffrozp - real, fractional snow/rain 1 ! ! dt - real, time step (<3600 sec) 1 ! ! zlvl - real, height abv atmos ground forcing vars (m) 1 ! ! sldpth - real, thickness of each soil layer (m) nsoil ! @@ -202,6 +207,8 @@ subroutine gfssflx & ! --- inpu ! shdmin - real, min areal coverage of green veg (fraction) 1 ! ! alb - real, bkground snow-free sfc albedo (fraction) 1 ! ! snoalb - real, max albedo over deep snow (fraction) 1 ! +! lheatstrg- logical, flag for canopy heat storage 1 ! +! parameterization ! ! ! ! input/outputs: ! ! tbot - real, bottom soil temp (k) 1 ! @@ -281,7 +288,7 @@ subroutine gfssflx & ! --- inpu ! real (kind=kind_phys), parameter :: gs = con_g !< con_g =9.80665 real (kind=kind_phys), parameter :: gs1 = 9.8 !< con_g in sfcdif real (kind=kind_phys), parameter :: gs2 = 9.81 !< con_g in snowpack, frh2o - real (kind=kind_phys), parameter :: tfreez = con_t0c !< con_t0c =275.15 + real (kind=kind_phys), parameter :: tfreez = con_t0c !< con_t0c =273.16 real (kind=kind_phys), parameter :: lsubc = 2.501e+6 !< con_hvap=2.5000e+6 real (kind=kind_phys), parameter :: lsubf = 3.335e5 !< con_hfus=3.3358e+5 real (kind=kind_phys), parameter :: lsubs = 2.83e+6 ! ? in sflx, snopac @@ -306,7 +313,9 @@ subroutine gfssflx & ! --- inpu real (kind=kind_phys), intent(in) :: ffrozp, dt, zlvl, lwdn, & & sldpth(nsoil), swdn, swnet, sfcems, sfcprs, sfctmp, & & sfcspd, prcp, q2, q2sat, dqsdt2, th2, shdmin, alb, snoalb, & - & bexpp, xlaip + & bexpp, xlaip & !sfc-perts, mgehne + + logical, intent(in) :: lheatstrg ! --- input/outputs: real (kind=kind_phys), intent(inout) :: tbot, cmc, t1, sneqv, & @@ -336,6 +345,12 @@ subroutine gfssflx & ! --- inpu logical :: frzgra, snowng integer :: ice, k, kz +! +! --- parameters for heat storage parametrization +! + real (kind=kind_phys) :: cpx, cpx1, cpfac, xx1, xx2, xx3 + real (kind=kind_phys), parameter :: z0min=0.2 + real (kind=kind_phys), parameter :: z0max=1.0 ! !===> ... begin here @@ -517,7 +532,7 @@ subroutine gfssflx & ! --- inpu !! rain is presumed to be falling. if (prcp > 0.0) then - if (ffrozp > 0.5) then + if (ffrozp > 0.) then snowng = .true. else if (t1 <= tfreez) frzgra = .true. @@ -533,9 +548,18 @@ subroutine gfssflx & ! --- inpu if (snowng .or. frzgra) then +! snowfall + if (snowng) then + sn_new = ffrozp*prcp * dt * 0.001 + sneqv = sneqv + sn_new + prcp1 = (1.-ffrozp)*prcp + endif +! freezing rain + if (frzgra) then sn_new = prcp * dt * 0.001 sneqv = sneqv + sn_new prcp1 = 0.0 + endif !> - Call snow_new() to update snow density based on new snowfall, !! using old and new snow. @@ -778,6 +802,23 @@ subroutine gfssflx & ! --- inpu fdown = swnet + lwdn endif ! end if_couple_block +! +! --- enhance cp as a function of z0 to mimic heat storage +! + cpx = cp + cpx1 = cp1 + cpfac = 1. + if(lheatstrg) then + if((ivegsrc == 1 .and. vegtyp /= 13) + & .or. ivegsrc == 2) then + xx1 = (z0 - z0min) / (z0max - z0min) + xx2 = min(max(xx1, 0.), 1.) + xx3 = 1. + xx2 + cpx = cp * xx3 + cpx1 = cp1 * xx3 + cpfac = cp / cpx + endif + endif !> - Call penman() to calculate potential evaporation (\a etp), !! and other partial products and sums for later @@ -786,7 +827,7 @@ subroutine gfssflx & ! --- inpu call penman ! --- inputs: ! ! ( sfctmp, sfcprs, sfcems, ch, t2v, th2, prcp, fdown, ! -! ssoil, q2, q2sat, dqsdt2, snowng, frzgra, ! +! cpx, cpfac, ssoil, q2, q2sat, dqsdt2, snowng, frzgra, ! ! --- outputs: ! ! t24, etp, rch, epsca, rr, flx2 ) ! @@ -801,7 +842,7 @@ subroutine gfssflx & ! --- inpu call canres ! --- inputs: ! ! ( nsoil, nroot, swdn, ch, q2, q2sat, dqsdt2, sfctmp, ! -! sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, ! +! cpx1, sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, ! ! rsmax, topt, rgl, hs, xlai, ! ! --- outputs: ! ! rc, pc, rcs, rct, rcq, rcsoil ) ! @@ -1025,7 +1066,7 @@ end subroutine alcalc subroutine canres ! --- inputs: ! & ( nsoil, nroot, swdn, ch, q2, q2sat, dqsdt2, sfctmp, & -! & sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, & +! & cpx1, sfcprs, sfcems, sh2o, smcwlt, smcref, zsoil, rsmin, & ! & rsmax, topt, rgl, hs, xlai, & ! --- outputs: ! & rc, pc, rcs, rct, rcq, rcsoil & @@ -1058,6 +1099,7 @@ subroutine canres ! q2sat - real, sat. air humidity at 1st level abv ground 1 ! ! dqsdt2 - real, slope of sat. humidity function wrt temp 1 ! ! sfctmp - real, sfc temperature at 1st level above ground 1 ! +! cpx1 - real, enhanced air heat capacity for heat storage 1 ! ! sfcprs - real, sfc pressure 1 ! ! sfcems - real, sfc emissivity for lw radiation 1 ! ! sh2o - real, volumetric soil moisture nsoil ! @@ -1163,8 +1205,8 @@ subroutine canres ! evaporation (containing rc term). rc = rsmin / (xlai*rcs*rct*rcq*rcsoil) - rr = (4.0*sfcems*sigma1*rd1/cp1) * (sfctmp**4.0)/(sfcprs*ch) + 1.0 - delta = (lsubc/cp1) * dqsdt2 + rr = (4.0*sfcems*sigma1*rd1/cpx1) * (sfctmp**4.0)/(sfcprs*ch) + 1.0 + delta = (lsubc/cpx1) * dqsdt2 pc = (rr + delta) / (rr*(1.0 + rc*ch) + delta) ! @@ -1513,7 +1555,7 @@ subroutine penman !................................... ! --- inputs: ! & ( sfctmp, sfcprs, sfcems, ch, t2v, th2, prcp, fdown, & -! & ssoil, q2, q2sat, dqsdt2, snowng, frzgra, & +! & cpx, cpfac, ssoil, q2, q2sat, dqsdt2, snowng, frzgra, & ! --- outputs: ! & t24, etp, rch, epsca, rr, flx2 & ! & ) @@ -1539,6 +1581,8 @@ subroutine penman ! th2 - real, air potential temp at zlvl abv grnd 1 ! ! prcp - real, precip rate 1 ! ! fdown - real, net solar + downward lw flux at sfc 1 ! +! cpx - real, enhanced air heat capacity for heat storage 1 ! +! cpfac - real, ratio air heat capacity to enhanced one 1 ! ! ssoil - real, upward soil heat flux 1 ! ! q2 - real, mixing ratio at hght zlvl abv ground 1 ! ! q2sat - real, sat mixing ratio at zlvl abv ground 1 ! @@ -1576,11 +1620,11 @@ subroutine penman ! --- ... prepare partial quantities for penman equation. - delta = elcp * dqsdt2 + delta = elcp * cpfac * dqsdt2 t24 = sfctmp * sfctmp * sfctmp * sfctmp rr = t24 * 6.48e-8 / (sfcprs*ch) + 1.0 rho = sfcprs / (rd1*t2v) - rch = rho * cp * ch + rch = rho * cpx * ch ! --- ... adjust the partial sums / products with the latent heat ! effects caused by falling precipitation. @@ -1588,7 +1632,9 @@ subroutine penman if (.not. snowng) then if (prcp > 0.0) rr = rr + cph2o1*prcp/rch else - rr = rr + cpice*prcp/rch +! ---- ... fractional snowfall/rainfall + rr = rr + (cpice*ffrozp+cph2o1*(1.-ffrozp)) & + & *prcp/rch endif fnet = fdown - sfcems*sigma1*t24 - ssoil @@ -1604,7 +1650,7 @@ subroutine penman ! --- ... finish penman equation calculations. rad = fnet/rch + th2 - sfctmp - a = elcp * (q2sat - q2) + a = elcp * cpfac * (q2sat - q2) epsca = (a*rr + rad*delta) / (delta + rr) etp = epsca * rch / lsubc ! @@ -2515,7 +2561,9 @@ subroutine snopac flx1 = 0.0 if ( snowng ) then - flx1 = cpice * prcp * (t1 - sfctmp) +! --- ... fractional snowfall/rainfall + flx1 = (cpice* ffrozp + cph2o1*(1.-ffrozp)) & + & * prcp * (t1 - sfctmp) else if (prcp > 0.0) flx1 = cph2o1 * prcp * (t1 - sfctmp) endif @@ -2919,8 +2967,10 @@ end subroutine snowz0 !> This subroutine calculates thermal diffusivity and conductivity !! of the soil for a given point and time. subroutine tdfcnd & - & ( smc, qz, smcmax, sh2o, & ! --- inputs: - & df & ! --- outputs: +! --- inputs: + & ( smc, qz, smcmax, sh2o, & +! --- outputs: + & df & & ) ! ===================================================================== ! @@ -3064,10 +3114,12 @@ end subroutine tdfcnd !! (cmc) is also updated. Frozen ground version: new states added: sh2o, !! and frozen ground correction factor, frzfact and paramter slope. subroutine evapo & - & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, & ! --- inputs: +! --- inputs: + & ( nsoil, nroot, cmc, cmcmax, etp1, dt, zsoil, & & sh2o, smcmax, smcwlt, smcref, smcdry, pc, & & shdfac, cfactr, rtdis, fxexp, & - & eta1, edir1, ec1, et1, ett1 & ! --- outputs: +! --- outputs: + & eta1, edir1, ec1, et1, ett1 & & ) ! ===================================================================== ! @@ -3211,10 +3263,13 @@ end subroutine evapo !! based on the thermal diffusion equation and update the frozen soil !! moisture content based on the temperature. subroutine shflx & - & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, & ! --- inputs +! --- inputs: + & ( nsoil, smc, smcmax, dt, yy, zz1, zsoil, zbot, & & psisat, bexp, df1, ice, quartz, csoil, vegtyp, & - & stc, t1, tbot, sh2o, & ! --- input/outputs - & ssoil & ! --- outputs: +! --- input/outputs: + & stc, t1, tbot, sh2o, & +! --- outputs: + & ssoil & & ) ! ===================================================================== ! @@ -3351,7 +3406,7 @@ subroutine shflx & t1 = ctfil1*t1 + ctfil2*oldt1 do i = 1, nsoil - stc(i) = ctfil1*stc(i) + ctfil2*stsoil(i) ! LX question mark + stc(i) = ctfil1*stc(i) + ctfil2*stsoil(i) enddo ! --- ... calculate surface soil heat flux @@ -3374,11 +3429,14 @@ end subroutine shflx !! (cmc) is also updated. Frozen ground version: new states added: sh2o and !! frozen ground correction factor, frzx and parameter slope. subroutine smflx & - & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, & ! --- inputs: +! --- inputs: + & ( nsoil, dt, kdt, smcmax, smcwlt, cmcmax, prcp1, & & zsoil, slope, frzx, bexp, dksat, dwsat, shdfac, & & edir1, ec1, et1, & - & cmc, sh2o, & ! --- input/outputs: - & smc, runoff1, runoff2, runoff3, drip & ! --- outputs: +! --- input/outputs: + & cmc, sh2o, & +! --- outputs: + & smc, runoff1, runoff2, runoff3, drip & & ) ! ===================================================================== ! @@ -3582,8 +3640,10 @@ end subroutine smflx !! by Victor Koren, 03/25/95. subroutine will return new values of \a snowh !! and \a sndens . subroutine snowpack & - & ( esd, dtsec, tsnow, tsoil, & ! --- inputs: - & snowh, sndens & ! --- input/outputs: +! --- inputs: + & ( esd, dtsec, tsnow, tsoil, & +! --- input/outputs: + & snowh, sndens & & ) ! ===================================================================== ! @@ -3743,8 +3803,10 @@ end subroutine snowpack !>\ingroup Noah_LSM !> This subrtouine calculates direct soil evaporation. subroutine devap & - & ( etp1, smc, shdfac, smcmax, smcdry, fxexp, & ! --- inputs: - & edir1 & ! --- outputs: +! --- inputs: + & ( etp1, smc, shdfac, smcmax, smcdry, fxexp, & +! --- outputs: + & edir1 & & ) ! ===================================================================== ! @@ -3821,8 +3883,10 @@ end subroutine devap !! implicit equation to a simpler explicit form, known as the "flerchinger eqn". !! Improved handling of solution in the limit of freezing point temperature t0. subroutine frh2o & - & ( tkelv, smc, sh2o, smcmax, bexp, psis, & ! --- inputs: - & liqwat & ! --- outputs: +! --- inputs: + & ( tkelv, smc, sh2o, smcmax, bexp, psis, & +! --- outputs: + & liqwat & & ) ! ===================================================================== ! @@ -3974,10 +4038,13 @@ end subroutine frh2o !! the matrix coefficients for the tri-diagonal matrix of the implicit time !! scheme. subroutine hrt & - & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, & ! --- inputs: +! --- inputs: + & ( nsoil, stc, smc, smcmax, zsoil, yy, zz1, tbot, & & zbot, psisat, dt, bexp, df1, quartz, csoil, vegtyp, & - & sh2o, & ! --- input/outputs: - & rhsts, ai, bi, ci & ! --- outputs: +! --- input/outputs: + & sh2o, & +! --- outputs: + & rhsts, ai, bi, ci & & ) ! ===================================================================== ! @@ -4318,9 +4385,12 @@ end subroutine hrt !! term of the soil thermal diffusion equation for sea-ice (ice = 1) or !! glacial-ice (ice). subroutine hrtice & - & ( nsoil, stc, zsoil, yy, zz1, df1, ice, & ! --- inputs: - & tbot, & ! --- input/outputs: - & rhsts, ai, bi, ci & ! --- outputs: +! --- inputs: + & ( nsoil, stc, zsoil, yy, zz1, df1, ice, & +! --- input/outputs: + & tbot, & +! --- outputs: + & rhsts, ai, bi, ci & & ) ! ===================================================================== ! @@ -4488,9 +4558,12 @@ end subroutine hrtice !>\ingroup Noah_LSM !> This subroutine calculates/updates the soil temperature field. subroutine hstep & - & ( nsoil, stcin, dt, & ! --- inputs: - & rhsts, ai, bi, ci, & ! --- input/outputs: - & stcout & ! --- outputs: +! --- inputs: + & ( nsoil, stcin, dt, & +! --- input/outputs: + & rhsts, ai, bi, ci, & +! --- outputs: + & stcout & & ) ! ===================================================================== ! @@ -4585,9 +4658,12 @@ end subroutine hstep !>\ingroup Noah_LSM !> This subroutine inverts (solve) the tri-diagonal matrix problem. subroutine rosr12 & - & ( nsoil, a, b, d, & ! --- inputs: - & c, & ! --- input/outputs: - & p, delta & ! --- outputs: +! --- inputs: + & ( nsoil, a, b, d, & +! --- input/outputs: + & c, & +! --- outputs: + & p, delta & & ) ! ===================================================================== ! @@ -4685,10 +4761,13 @@ end subroutine rosr12 !>\ingroup Noah_LSM !> This subroutine calculates sink/source term of the termal diffusion equation. subroutine snksrc & - & ( nsoil, k, tavg, smc, smcmax, psisat, bexp, dt, & ! --- inputs: +! --- inputs: + & ( nsoil, k, tavg, smc, smcmax, psisat, bexp, dt, & & qtot, zsoil, & - & sh2o, & ! --- input/outputs: - & tsrc & ! --- outputs: +! --- input/outputs: + & sh2o, & +! --- outputs: + & tsrc & & ) ! ===================================================================== ! @@ -4827,9 +4906,11 @@ end subroutine snksrc !! (prepare) the matrix coefficients for the tri-diagonal matrix of !! the implicit time scheme. subroutine srt & - & ( nsoil, edir, et, sh2o, sh2oa, pcpdrp, zsoil, dwsat, & ! --- inputs: +! --- inputs: + & ( nsoil, edir, et, sh2o, sh2oa, pcpdrp, zsoil, dwsat, & & dksat, smcmax, bexp, dt, smcwlt, slope, kdt, frzx, sice, & - & rhstt, runoff1, runoff2, ai, bi, ci & ! --- outputs: +! --- outputs: + & rhstt, runoff1, runoff2, ai, bi, ci & & ) ! ===================================================================== ! @@ -5137,9 +5218,12 @@ end subroutine srt !> This subroutine calculates/updates soil moisture content values and !! canopy moisture content values. subroutine sstep & - & ( nsoil, sh2oin, rhsct, dt, smcmax, cmcmax, zsoil, sice, & ! --- inputs: - & cmc, rhstt, ai, bi, ci, & ! --- input/outputs: - & sh2oout, runoff3, smc & ! --- outputs: +! --- inputs: + & ( nsoil, sh2oin, rhsct, dt, smcmax, cmcmax, zsoil, sice, & +! --- input/outputs: + & cmc, rhstt, ai, bi, ci, & +! --- outputs: + & sh2oout, runoff3, smc & & ) ! ===================================================================== ! @@ -5282,8 +5366,10 @@ end subroutine sstep !> This subroutine calculates temperature on the boundary of the !! layer by interpolation of the middle layer temperatures. subroutine tbnd & - & ( tu, tb, zsoil, zbot, k, nsoil, & ! --- inputs: - & tbnd1 & ! --- outputs: +! --- inputs: + & ( tu, tb, zsoil, zbot, k, nsoil, & +! --- outputs: + & tbnd1 & & ) ! ===================================================================== ! @@ -5355,8 +5441,10 @@ end subroutine tbnd !! tdn is at bottom boundary of layer. tm is layer prognostic state !! temperature. subroutine tmpavg & - & ( tup, tm, tdn, zsoil, nsoil, k, & ! --- inputs: - & tavg & ! --- outputs: +! --- inputs: + & ( tup, tm, tdn, zsoil, nsoil, k, & +! --- outputs: + & tavg & & ) ! ===================================================================== ! @@ -5458,9 +5546,11 @@ end subroutine tmpavg !>\ingroup Noah_LSM !> This subroutine calculates transpiration for the veg class. subroutine transp & - & ( nsoil, nroot, etp1, smc, smcwlt, smcref, & ! --- inputs: +! --- inputs: + & ( nsoil, nroot, etp1, smc, smcwlt, smcref, & & cmc, cmcmax, zsoil, shdfac, pc, cfactr, rtdis, & - & et1 & ! --- outputs: +! --- outputs: + & et1 & & ) ! ===================================================================== ! @@ -5590,8 +5680,10 @@ end subroutine transp !> This subroutine calculates soil water diffusivity and soil !! hydraulic conductivity. subroutine wdfcnd & - & ( smc, smcmax, bexp, dksat, dwsat, sicemax, & ! --- inputs: - & wdf, wcnd & ! --- outputs: +! --- inputs: + & ( smc, smcmax, bexp, dksat, dwsat, sicemax, & +! --- outputs: + & wdf, wcnd & & ) ! ===================================================================== ! @@ -5632,8 +5724,6 @@ subroutine wdfcnd & ! ! --- ... calc the ratio of the actual to the max psbl soil h2o content -! factr1 = 0.2 / smcmax -! factr2 = smc / smcmax factr1 = min(1.0, max(0.0, 0.2/smcmax)) factr2 = min(1.0, max(0.0, smc/smcmax)) diff --git a/stochastic_physics/stochastic_physics.F90 b/stochastic_physics/stochastic_physics.F90 index 881d45126..e0ce62d17 100644 --- a/stochastic_physics/stochastic_physics.F90 +++ b/stochastic_physics/stochastic_physics.F90 @@ -77,6 +77,10 @@ subroutine stochastic_physics_init(Model, nthreads, errmsg, errflg) gis_stochy%me=me gis_stochy%nodes=nodes call init_stochdata(Model%levs,Model%dtp,Model%input_nml_file,Model%fn_nml,Model%nlunit,iret) +! check to see decomposition +!if(Model%isppt_deep == .true.)then +!do_sppt = .true. +!endif ! check namelist entries for consistency if (Model%do_sppt.neqv.do_sppt) then write(errmsg,'(*(a))') 'Logic error in stochastic_physics_init: incompatible', & @@ -354,7 +358,6 @@ subroutine stochastic_physics_sfc_init(Model, Data, errmsg, errflg) use get_stochy_pattern_mod,only : get_random_pattern_sfc_fv3 ! mg, sfc-perts use stochy_resol_def , only : latg,lonf use stochy_namelist_def -use spectral_layout_mod,only:me use GFS_typedefs, only: GFS_control_type, GFS_data_type implicit none type(GFS_control_type), intent(in) :: Model diff --git a/stochastic_physics/stochy_ccpp.F90 b/stochastic_physics/stochy_ccpp.F90 index 1947f861a..f7c7ce60a 100644 --- a/stochastic_physics/stochy_ccpp.F90 +++ b/stochastic_physics/stochy_ccpp.F90 @@ -232,7 +232,7 @@ subroutine stochy_la2ga(regin,imxin,jmxin,rinlon,rinlat,rlon,rlat, & ! len_thread_m = (len+ompthreads-1) / ompthreads ! - !$omp parallel do default(none) & + !$omp parallel do num_threads(ompthreads) default(none) & !$omp private(i1_t,i2_t,len_thread,it,i,ii,i1,i2) & !$omp private(j,j1,j2,jq,ix,jy,nx,kxs,kxt,kmami) & !$omp private(alamd,denom,rnume,aphi,x,y,wsum,wsumiv,sum1,sum2) &