From 4fa6a3bef55798cf23a092fce1f51053fc42f01a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 2 Aug 2021 09:41:04 -0600 Subject: [PATCH] Initialize MG constants in init phase, adjust formatting in gscond.f --- physics/aerclm_def.F | 2 +- physics/gscond.f | 24 +++---- physics/m_micro.F90 | 67 ++++++++++++-------- physics/m_micro.meta | 145 ++++++++++++++----------------------------- 4 files changed, 96 insertions(+), 142 deletions(-) diff --git a/physics/aerclm_def.F b/physics/aerclm_def.F index 3862aa1b1..157c7b961 100644 --- a/physics/aerclm_def.F +++ b/physics/aerclm_def.F @@ -1,7 +1,7 @@ module aerclm_def use machine , only : kind_phys implicit none - + integer, parameter :: levsaer=72, ntrcaerm=15, timeaer=12 integer :: latsaer, lonsaer, ntrcaer, levsw diff --git a/physics/gscond.f b/physics/gscond.f index f36de0209..8756bc320 100644 --- a/physics/gscond.f +++ b/physics/gscond.f @@ -122,14 +122,10 @@ subroutine zhaocarr_gscond_run (im,km,dt,dtf,prsl,ps,q,clw1 & integer, intent(out) :: errflg ! ! Local variables - real (kind=kind_phys) h1 - &, d00, elwv, eliv - &, epsq - &, r, cpr, rcp - - parameter (h1=1.e0, d00=0.e0 & - &, epsq=2.e-12) - + real (kind=kind_phys) h1, d00, elwv, eliv + &, epsq, r, cpr, rcp +! + parameter (h1=1.e0, d00=0.e0, epsq=2.e-12) ! real(kind=kind_phys), parameter :: cons_0=0.0, cons_m15=-15.0 ! @@ -157,15 +153,13 @@ subroutine zhaocarr_gscond_run (im,km,dt,dtf,prsl,ps,q,clw1 & enddo !-----------------prepare constants for later uses----------------- ! - elwv=hvap - eliv=hvap+hfus - r=rd - cpr=cp*r - rcp=h1/cp - + elwv = hvap + eliv = hvap+hfus + r = rd + cpr = cp*r + rcp = h1/cp el2orc = hvap*hvap / (rv*cp) albycp = hvap / cp -! write(0,*)' in gscond im=',im ! rdt = h1/dt us = h1 diff --git a/physics/m_micro.F90 b/physics/m_micro.F90 index 51ce44d7f..15e30b0a6 100644 --- a/physics/m_micro.F90 +++ b/physics/m_micro.F90 @@ -7,11 +7,26 @@ !> This module contains the CCPP-compliant Morrison-Gettelman microphysics (MG1, MG2 and MG3) scheme. module m_micro + use machine, only: kind_phys + implicit none public :: m_micro_init, m_micro_run, m_micro_finalize private logical :: is_initialized = .False. + real, parameter :: one = 1.0_kind_phys, & + oneb3 = one/3.0_kind_phys, & + zero = 0.0_kind_phys, & + half = 0.5_kind_phys, & + qsmall = 1.0e-14_kind_phys, & + fourb3 = 4.0_kind_phys/3.0_kind_phys, & + RL_cub = 1.0e-15_kind_phys, & + nmin = 1.0_kind_phys + + real(kind=kind_phys) :: grav, pi, rgas, cp, hvap, hfus, ttp, & + tice, eps, epsm1, VIREPS, onebcp, onebg, & + kapa, cpbg, lvbcp, lsbcp + contains !> This subroutine is the MG initialization. @@ -19,7 +34,8 @@ module m_micro !! \htmlinclude m_micro_init.html !! subroutine m_micro_init(imp_physics, imp_physics_mg, fprcp, gravit, rair, rh2o, cpair,& - eps, tmelt, latvap, latice, mg_dcs, mg_qcvar, mg_ts_auto_ice, & + eps_in, epsm1_in, tmelt, latvap, latice, pi_in, tice_in, & + VIREPS_in, mg_dcs, mg_qcvar, mg_ts_auto_ice, & mg_rhmini, microp_uniform, do_cldice, hetfrz_classnuc, & mg_precip_frac_method, mg_berg_eff_factor, sed_supersat, & do_sb_physics, mg_do_hail, mg_do_graupel, mg_nccons, & @@ -37,7 +53,8 @@ subroutine m_micro_init(imp_physics, imp_physics_mg, fprcp, gravit, rair, rh2o, sed_supersat, do_sb_physics, mg_do_hail, & mg_do_graupel, mg_nccons, mg_nicons, mg_ngcons, & mg_do_ice_gmao, mg_do_liq_liu - real(kind=kind_phys), intent(in) :: gravit, rair, rh2o, cpair, eps, tmelt, latvap, latice + real(kind=kind_phys), intent(in) :: gravit, rair, rh2o, cpair, eps_in, epsm1_in, & + tmelt, latvap, latice, pi_in, tice_in, VIREPS_in real(kind=kind_phys), intent(in) :: mg_dcs, mg_qcvar, mg_ts_auto_ice(:), mg_rhmini, & mg_berg_eff_factor, mg_ncnst, mg_ninst, mg_ngnst character(len=16), intent(in) :: mg_precip_frac_method @@ -55,6 +72,25 @@ subroutine m_micro_init(imp_physics, imp_physics_mg, fprcp, gravit, rair, rh2o, return end if + ! Assign constants + grav = gravit + pi = pi_in + rgas = rair + cp = cpair + hvap = latvap + hfus = latice + ttp = tmelt + tice = tice_in + eps = eps_in + epsm1 = epsm1_in + VIREPS = VIREPS_in + onebcp = one/cp + onebg = one/grav + kapa = rgas*onebcp + cpbg = cp/grav + lvbcp = hvap*onebcp + lsbcp = (hvap+hfus)*onebcp + if (fprcp <= 0) then call ini_micro (mg_dcs, mg_qcvar, mg_ts_auto_ice(1)) elseif (fprcp == 1) then @@ -108,9 +144,6 @@ end subroutine m_micro_finalize !>\section detail_m_micro_run MG m_micro_run Detailed Algorithm !> @{ subroutine m_micro_run( im, lm, flipv, dt_i & - &, grav, pi, rgas, cp & - &, hvap, hfus, ttp, tice & - &, eps, epsm1, VIREPS & &, prsl_i, prsi_i, phil, phii & &, omega_i, QLLS_i, QLCN_i, QILS_i, QICN_i& &, lwheat_i, swheat_i, w_upi, cf_upi & @@ -124,15 +157,13 @@ subroutine m_micro_run( im, lm, flipv, dt_i & &, qgl_io, ncpr_io, ncps_io, ncgl_io & &, CLLS_io, KCBL, rainmin & &, CLDREFFL, CLDREFFI, CLDREFFR, CLDREFFS & - &, CLDREFFG, aerfld_i & + &, CLDREFFG, ntrcaer, aerfld_i & &, naai_i, npccn_i, iccn & &, skip_macro & &, alf_fac, qc_min, pdfflag & &, kdt, xlat, xlon, rhc_i, & & errmsg, errflg) - use machine , only: kind_phys - ! use funcphys, only: fpvs !< saturation vapor pressure for water-ice mixed ! use funcphys, only: fpvsl, fpvsi, fpvs !< saturation vapor pressure for water,ice & mixed use aer_cloud, only: AerProps, getINsubset,init_aer, & @@ -142,8 +173,6 @@ subroutine m_micro_run( im, lm, flipv, dt_i & use cldwat2m_micro,only: mmicro_pcond use micro_mg2_0, only: micro_mg_tend2_0 => micro_mg_tend, qcvar2 => qcvar use micro_mg3_0, only: micro_mg_tend3_0 => micro_mg_tend, qcvar3 => qcvar - ! DH* TODO - make this an input argument, no cross-import! - use aerclm_def, only: ntrcaer ! use wv_saturation, only: aqsat @@ -160,17 +189,10 @@ subroutine m_micro_run( im, lm, flipv, dt_i & ! input ! real, parameter :: r_air = 3.47d-3 integer, parameter :: kp = kind_phys - real(kind=kind_phys), intent(in ) :: rainmin, grav, pi, rgas, cp, & - & hvap, hfus, ttp, tice, eps, epsm1, VIREPS + real(kind=kind_phys), intent(in ) :: rainmin - real, parameter :: one=1.0_kp, oneb3=one/3.0_kp, & - zero=0.0_kp, half=0.5_kp, & - & qsmall=1.0e-14_kp, & - & fourb3=4.0_kp/3.0_kp, RL_cub=1.0e-15_kp, & - & nmin=1.0_kp - real(kind=kind_phys) :: onebcp, onebg, kapa, cpbg, lvbcp, lsbcp integer, parameter :: ncolmicro = 1 - integer,intent(in) :: im, lm, kdt, fprcp, pdfflag, iccn + integer,intent(in) :: im, lm, kdt, fprcp, pdfflag, iccn, ntrcaer logical,intent(in) :: flipv, skip_macro real (kind=kind_phys), intent(in):: dt_i, alf_fac, qc_min(:) @@ -394,13 +416,6 @@ subroutine m_micro_run( im, lm, flipv, dt_i & ipr = 1 ! rhr8 = 1.0 - - onebcp=one/cp - onebg=one/grav - kapa=rgas*onebcp - cpbg=cp/grav - lvbcp=hvap*onebcp - lsbcp=(hvap+hfus)*onebcp if(flipv) then DO K=1, LM diff --git a/physics/m_micro.meta b/physics/m_micro.meta index 6bda8cec0..8a51a6ec6 100644 --- a/physics/m_micro.meta +++ b/physics/m_micro.meta @@ -67,7 +67,7 @@ kind = kind_phys intent = in optional = F -[eps] +[eps_in] standard_name = ratio_of_dry_air_to_water_vapor_gas_constants long_name = rd/rv units = none @@ -76,6 +76,15 @@ kind = kind_phys intent = in optional = F +[epsm1_in] + standard_name = ratio_of_dry_air_to_water_vapor_gas_constants_minus_one + long_name = (rd/rv) - 1 + units = none + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F [tmelt] standard_name = triple_point_temperature_of_water long_name = triple point temperature of water @@ -103,6 +112,33 @@ kind = kind_phys intent = in optional = F +[pi_in] + standard_name = pi + long_name = ratio of a circle's circumference to its diameter + units = none + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F +[tice_in] + standard_name = temperature_at_zero_celsius + long_name = temperature at 0 degree Celsius + units = K + dimensions = () + type = real + kind = kind_phys + intent = in + optional = F +[VIREPS_in] + 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 + optional = F [mg_dcs] standard_name = autoconverion_to_snow_size_threshold long_name = autoconversion size threshold for cloud ice to snow for MG microphysics @@ -344,105 +380,6 @@ kind = kind_phys intent = in optional = F -[grav] - standard_name = gravitational_acceleration - long_name = gravitational acceleration - units = m s-2 - dimensions = () - type = real - kind = kind_phys - intent = in - optional = F -[pi] - standard_name = pi - long_name = ratio of a circle's circumference to its diameter - units = none - dimensions = () - type = real - kind = kind_phys - intent = in - optional = F -[rgas] - 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 - optional = F -[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 - optional = F -[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 - optional = F -[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 - optional = F -[ttp] - standard_name = triple_point_temperature_of_water - long_name = triple point temperature of water - units = K - dimensions = () - type = real - kind = kind_phys - intent = in - optional = F -[tice] - standard_name = temperature_at_zero_celsius - long_name = temperature at 0 degree Celsius - units = K - dimensions = () - type = real - kind = kind_phys - intent = in - optional = F -[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 - optional = F -[epsm1] - standard_name = ratio_of_dry_air_to_water_vapor_gas_constants_minus_one - long_name = (rd/rv) - 1 - units = none - dimensions = () - type = real - kind = kind_phys - intent = in - optional = F -[VIREPS] - 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 - optional = F [prsl_i] standard_name = air_pressure long_name = layer mean pressure @@ -882,6 +819,14 @@ kind = kind_phys intent = out optional = F +[ntrcaer] + standard_name = number_of_aerosol_tracers_MG + long_name = number of aerosol tracers for Morrison Gettelman MP + units = count + dimensions = () + type = integer + intent = in + optional = F [aerfld_i] standard_name = mass_number_concentration_of_aerosol_from_gocart_climatology long_name = GOCART aerosol climatology number concentration