diff --git a/CCPP/module_sf_mynnsfc_driver.F90 b/CCPP/module_sf_mynnsfc_driver.F90 index 3989774..2e1e1d7 100644 --- a/CCPP/module_sf_mynnsfc_driver.F90 +++ b/CCPP/module_sf_mynnsfc_driver.F90 @@ -19,9 +19,14 @@ MODULE module_sf_mynnsfc_driver !! \htmlinclude module_sf_mynnsfc_driver_init.html !! subroutine module_sf_mynnsfc_driver_init(do_mynnsfclay, & - & errmsg, errflg) + con_cp, con_g, con_rd, con_rv, & + con_rocp, con_hvap, con_hfus, con_fvirt, & + con_eps, errmsg, errflg) logical, intent(in) :: do_mynnsfclay + real(kind_phys), intent(in) :: con_cp, con_g, con_rd, con_rv + real(kind_phys), intent(in) :: con_rocp, con_hvap, con_hfus, con_fvirt + real(kind_phys), intent(in) :: con_eps character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg @@ -29,6 +34,11 @@ subroutine module_sf_mynnsfc_driver_init(do_mynnsfclay, & errmsg = '' errflg = 0 + ! Initialize sf_mynn + call sf_mynn_init(con_cp, con_g, con_rd, con_rv, & + con_rocp, con_hvap, con_hfus, con_fvirt, & + con_eps) + ! Consistency checks if (.not. do_mynnsfclay) then write(errmsg,fmt='(*(a))') 'Logic error: do_mynnsfclay = .false.' @@ -94,8 +104,6 @@ SUBROUTINE module_sf_mynnsfc_driver_run( & ! should be moved to inside the mynn: use machine , only : kind_phys - use physcons, only : cp => con_cp, & - & grav => con_g ! USE module_sf_mynnsfc, only : SFCLAY_mynn !tgs - info on iterations: @@ -111,8 +119,6 @@ SUBROUTINE module_sf_mynnsfc_driver_run( & !------------------------------------------------------------------- implicit none !------------------------------------------------------------------- -! --- derive more constant parameters: - real(kind_phys), parameter :: g_inv=1./grav character(len=*), intent(out) :: errmsg integer, intent(out) :: errflg diff --git a/CCPP/module_sf_mynnsfc_driver.meta b/CCPP/module_sf_mynnsfc_driver.meta index 1700807..dcbddc9 100644 --- a/CCPP/module_sf_mynnsfc_driver.meta +++ b/CCPP/module_sf_mynnsfc_driver.meta @@ -1,7 +1,7 @@ [ccpp-table-properties] name = module_sf_mynnsfc_driver type = scheme - dependencies = ../../../../hooks/machine.F,../../../../hooks/physcons.F90,../module_sf_mynnsfc.F90 + dependencies = ../../../../hooks/machine.F,../module_sf_mynnsfc.F90 ######################################################################## [ccpp-arg-table] @@ -14,6 +14,78 @@ dimensions = () type = logical intent = in +[con_cp] + standard_name = specific_heat_of_dry_air_at_constant_pressure + long_name = specific heat of dry air at constant pressure + units = J kg-1 K-1 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_g] + standard_name = gravitational_acceleration + long_name = gravitational acceleration + units = m s-2 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_rd] + standard_name = gas_constant_of_dry_air + long_name = ideal gas constant for dry air + units = J kg-1 K-1 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_rv] + standard_name = gas_constant_water_vapor + long_name = ideal gas constant for water vapor + units = J kg-1 K-1 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_rocp] + standard_name = ratio_of_gas_constant_dry_air_to_specific_heat_of_dry_air_at_constant_pressure + long_name = (rd/cp) + units = none + dimensions = () + type = real + kind = kind_phys + intent = in +[con_hvap] + standard_name = latent_heat_of_vaporization_of_water_at_0C + long_name = latent heat of evaporation/sublimation + units = J kg-1 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_hfus] + standard_name = latent_heat_of_fusion_of_water_at_0C + long_name = latent heat of fusion + units = J kg-1 + dimensions = () + type = real + kind = kind_phys + intent = in +[con_fvirt] + standard_name = ratio_of_vapor_to_dry_air_gas_constants_minus_one + long_name = (rv/rd) - 1 (rv = ideal gas constant for water vapor) + units = none + dimensions = () + type = real + kind = kind_phys + intent = in +[con_eps] + standard_name = ratio_of_dry_air_to_water_vapor_gas_constants + long_name = rd/rv + units = none + dimensions = () + type = real + kind = kind_phys + intent = in [errmsg] standard_name = ccpp_error_message long_name = error message for error handling in CCPP diff --git a/module_sf_mynnsfc.F90 b/module_sf_mynnsfc.F90 index 724e296..53c6d95 100644 --- a/module_sf_mynnsfc.F90 +++ b/module_sf_mynnsfc.F90 @@ -63,18 +63,6 @@ MODULE module_sf_mynnsfc !NOTE: This code was primarily tested in combination with the RUC LSM. ! Performance with the Noah (or other) LSM is relatively unknown. !------------------------------------------------------------------- -!Include host model constants - use physcons, only : cp => con_cp, & !=7*Rd/2 - & grav => con_g, & !=9.81 - & Rd => con_rd, & !=287. - & Rv => con_rv, & !=461.6 -! & cpv => con_cvap, & !=4*Rv - & rovcp => con_rocp, & !=Rd/cp - & xlv => con_hvap, & !2.5e6 - & xlf => con_hfus, & !3.5e5 - & ep1 => con_fvirt, & !Rv/Rd - 1 - & ep2 => con_eps !Rd/Rv - !use kind_phys for real-types use machine , only : kind_phys @@ -82,9 +70,21 @@ MODULE module_sf_mynnsfc IMPLICIT NONE !------------------------------------------------------------------- !Drive and/or define more constant: - real(kind_phys), parameter :: ep3 = 1.-ep2 - real(kind_phys), parameter :: g_inv = 1.0/grav - real(kind_phys), parameter :: rvovrd = Rv/Rd + real(kind_phys) :: cp = 1.0E30_kind_phys + real(kind_phys) :: grav = 1.0E30_kind_phys + real(kind_phys) :: Rd = 1.0E30_kind_phys + real(kind_phys) :: Rv = 1.0E30_kind_phys + real(kind_phys) :: rovcp = 1.0E30_kind_phys + real(kind_phys) :: xlv = 1.0E30_kind_phys + real(kind_phys) :: xlf = 1.0E30_kind_phys + real(kind_phys) :: ep1 = 1.0E30_kind_phys + real(kind_phys) :: ep2 = 1.0E30_kind_phys + real(kind_phys) :: ep3 = 1.0E30_kind_phys + real(kind_phys) :: g_inv = 1.0E30_kind_phys + real(kind_phys) :: rvovrd = 1.0E30_kind_phys +!$acc declare create(cp, grav, Rd, Rv, rovcp, xlv, xlf, & +!$acc ep1, ep2, ep3, g_inv, rvovrd) + real(kind_phys), parameter :: wmin = 0.1 ! Minimum wind speed real(kind_phys), parameter :: karman = 0.4 real(kind_phys), parameter :: SVP1 = 0.6112 @@ -112,6 +112,32 @@ MODULE module_sf_mynnsfc CONTAINS + subroutine sf_mynn_init(con_cp, con_g, con_rd, con_rv, & + con_rocp, con_hvap, con_hfus, con_fvirt, & + con_eps) + real(kind_phys), intent(in) :: con_cp, con_g, con_rd, con_rv + real(kind_phys), intent(in) :: con_rocp, con_hvap, con_hfus, con_fvirt + real(kind_phys), intent(in) :: con_eps +!Include host model constants + cp = con_cp + grav = con_g + Rd = con_rd + Rv = con_rv + rovcp = con_rocp + xlv = con_hvap + xlf = con_hfus + ep1 = con_fvirt + ep2 = con_eps + + ep3 = 1.-ep2 + g_inv = 1.0/grav + rvovrd = Rv/Rd + +!$acc update device(cp, grav, Rd, Rv, rovcp, xlv, xlf, & +!$acc ep1, ep2, ep3, g_inv, rvovrd) + end subroutine sf_mynn_init + + !------------------------------------------------------------------- !------------------------------------------------------------------- !>\ingroup mynn_sfc @@ -2270,7 +2296,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter, & !$acc THSK_lnd, THSK_wat, THSK_ice, & !$acc QSFC_lnd, QSFC_wat, QSFC_ice, & !$acc U10, V10, U1D, V1D, U1D2, V1D2, & - !$acc ZNTstoch_lnd, ZNTstoch_lnd, ZNTstoch_ice, & + !$acc ZNTstoch_lnd, ZNTstoch_wat, ZNTstoch_ice, & !$acc PSIX_lnd, PSIX_wat, PSIX_ice, & !$acc PSIX10_lnd, PSIX10_wat, PSIX10_ice, & !$acc PSIT2_lnd, PSIT2_wat, PSIT2_ice, & @@ -2392,7 +2418,7 @@ SUBROUTINE SFCLAY1D_mynn(flag_iter, & !----------------------------------------------------- !$acc serial present(dry, wet, icy, CPM, MAVAIL, & !$acc HFX, LH, wstar, RHO1D, PBLH, ZOL, ZA, MOL, & -!$acc PSIM, PSIH, WSTAR, T1D, TH1D, THV1D, QVSH, & +!$acc PSIM, PSIH, T1D, TH1D, THV1D, QVSH, & !$acc UST_wat, UST_lnd, UST_ice, & !$acc THSK_wat, THSK_lnd, THSK_ice, & !$acc THVSK_wat, THVSK_lnd, THVSK_ice, &