diff --git a/bld/build-namelist b/bld/build-namelist index 29777bc449..1aeb2e0f4a 100755 --- a/bld/build-namelist +++ b/bld/build-namelist @@ -583,16 +583,13 @@ if ( ($chem ne 'none') or ( $prog_species ) ){ my $chem_proc_src = $cfg->get('chem_proc_src'); my $chem_src_dir = $cfg->get('chem_src_dir'); - my ( $gas_wetdep_list, $gas_wetdep_ice_uptake_list, $aer_wetdep_list, - $aer_sol_facti, $aer_sol_factb, $aer_scav_coef, $gas_drydep_list, $aer_drydep_list ) = + my ( $gas_wetdep_list, $aer_wetdep_list, $aer_sol_facti, $aer_sol_factb, $aer_scav_coef, + $aer_drydep_list, $gas_drydep_list ) = set_dep_lists( $chem, $cfgdir, $chem_proc_src, $chem_src_dir, $nl, $print ); if (length($gas_wetdep_list)>2){ add_default($nl, 'gas_wetdep_method' ); add_default($nl, 'gas_wetdep_list', 'val'=>$gas_wetdep_list ); - if (($chem =~ /_slh/) and (length($gas_wetdep_ice_uptake_list)>2)) { - add_default($nl, 'gas_wetdep_ice_uptake_list', 'val'=>$gas_wetdep_ice_uptake_list ); - } } if (length($aer_wetdep_list)>2){ @@ -1940,11 +1937,11 @@ if (($chem =~ /trop_mozart/ or $chem =~ /trop_strat/ or $chem =~ /waccm_tsmlt/) 'ISOP -> ' => 'isop_emis_file', 'TOLUENE -> ' => 'toluene_emis_file', ); - if (!($chem =~ /_vbs/) and !($chem =~ /_tsmlt/) and !($chem =~ /_t1s/)) { + if (!($chem =~ /_vbs/) and !($chem =~ /_tsmlt/)) { %species = (%species, 'NH3 -> ' => 'nh3_emis_file'); } - if (!($chem =~ /_vbs/) and !($chem =~ /_tsmlt/) and !($chem =~ /_t1s/)) { + if (!($chem =~ /_vbs/) and !($chem =~ /_tsmlt/)) { %species = (%species, 'C10H16 -> ' => 'c10h16_emis_file', ); } @@ -2360,25 +2357,6 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { 'soag_bb_srf_file' => 'SOAG' ); } - # for short-lived halogen (SLH) chemistry - if ($chem =~ /_slh/) { - %species = (%species, - 'c2cl4_slh_emis_file' => 'C2CL4', - 'ch2br2_slh_emis_file' => 'CH2BR2', - 'ch2brcl_slh_emis_file' => 'CH2BRCL', - 'ch2cl2_slh_emis_file' => 'CH2CL2', - 'ch2i2_slh_emis_file' => 'CH2I2', - 'ch2ibr_slh_emis_file' => 'CH2IBR', - 'ch2icl_slh_emis_file' => 'CH2ICL', - 'ch3i_slh_emis_file' => 'CH3I', - 'chbr2cl_slh_emis_file' => 'CHBR2CL', - 'chbr3_slh_emis_file' => 'CHBR3', - 'chbrcl2_slh_emis_file' => 'CHBRCL2', - 'hoi_slh_emis_file' => 'HOI', - 'i2_slh_emis_file' => 'I2' ); - } - - # for mid-atmos gas-phase chemistry if ($chem =~ /trop_strat/ or $chem =~ /_tsmlt/ or $chem =~ /waccm_ma/ or $chem =~ /waccm_t4ma/) { %species = (%species, @@ -2392,7 +2370,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { 'CH2O_bb_srf_file' => 'CH2O' ); } - # for troposphere gas-phase chemistry + # for troposphere gas-phase chemistry if ($chem =~ /trop_strat/ or $chem =~ /_tsmlt/ or $chem =~ /_t4ma/) { %species = (%species, 'BIGALK_an_srf_file' => 'BIGALK', @@ -2429,7 +2407,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { %species = (%species, 'E90_srf_file' => 'E90' ); } - if ($chem !~ /_t4s/ and $chem !~ /_t4ma/) { + if ($chem !~ /_ts4/ and $chem !~ /_t4ma/) { %species = (%species, 'BENZENE_an_srf_file' => 'BENZENE', 'BENZENE_bb_srf_file' => 'BENZENE', @@ -2450,10 +2428,10 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { 'XYLENES_an_srf_file' => 'XYLENES', 'XYLENES_bb_srf_file' => 'XYLENES' ) ; } - if ($chem =~ /trop_strat_mam4_ts2/ or $chem =~ /trop_strat_mam5_t2s1/) { + if ($chem =~ /trop_strat_mam4_ts2/ or $chem =~ /trop_strat_mam5_ts2/) { %species = (%species, 'MTERP_bb_srf_file' => 'APIN') ; - } elsif ($chem =~ /_t4s/ or $chem =~ /_t4ma/) { + } elsif ($chem =~ /_ts4/ or $chem =~ /_t4ma/) { %species = (%species, 'MTERP_bb_srf_file' => 'TERP') ; } else { @@ -2478,7 +2456,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { 'IVOC_bb_srf_file' => 'IVOCbb', 'SVOC_an_srf_file' => 'SVOCff', 'SVOC_bb_srf_file' => 'SVOCbb' ); - } elsif ($chem !~ /_t4s/ and $chem !~ /_t4ma/) { + } elsif ($chem !~ /_ts4/ and $chem !~ /_t4ma/) { %species = (%species, 'IVOC_an_srf_file' => 'IVOC', 'IVOC_bb_srf_file' => 'IVOC', @@ -2503,7 +2481,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { $first = 0; } } - if ($chem eq 'trop_mam4' or $chem eq 'waccm_sc_mam4' or $chem eq 'ghg_mam4' or $chem =~ /_t4s/ or $chem =~ /_t4ma/) { + if ($chem eq 'trop_mam4' or $chem eq 'waccm_sc_mam4' or $chem eq 'ghg_mam4' or $chem =~ /_ts4/ or $chem =~ /_t4ma/) { # SOA yields (used for the interactive emissions) have been calculated based on the VBS yields in CAM-chem. # Duseong S. Jo, et al. to be submitted to GMD, 2023 -- see https://github.com/ESCOMP/CAM/pull/727 discussion for additional detail. my %soae_fctrs = ('BENZENE_an_srf_file' => '2.5592D0', @@ -2679,7 +2657,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { add_default($nl, 'megan_factors_file'); add_default($nl, 'megan_mapped_emisfctrs', 'val'=>'.false.'); } - if ($chem =~ /trop_strat_mam4_vbs/ or $chem =~ /trop_strat_mam5_vbsext/ or $chem =~ /trop_strat_mam5_t1s/ or $chem =~ /trop_strat_mam5_slh/) { + if ($chem =~ /trop_strat_mam4_vbs/ or $chem =~ /trop_strat_mam5_vbs/) { my $val = "'ISOP = isoprene'," . "'MTERP = carene_3 + pinene_a + thujene_a + bornene + terpineol_4 + terpineol_a + terpinyl_ACT_a " . "+ myrtenal + sabinene + pinene_b + camphene + fenchene_a + limonene + phellandrene_a + terpinene_a " @@ -2718,7 +2696,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { add_default($nl, 'megan_factors_file'); add_default($nl, 'megan_mapped_emisfctrs', 'val'=>'.false.'); } - if ($chem =~ /trop_strat_mam5_t4s2/ or $chem =~ /_t4ma/) { + if ($chem =~ /trop_strat_mam5_ts4/ or $chem =~ /_t4ma/) { my $val = "'ISOP = isoprene'," . "'TERP = carene_3 + pinene_a + thujene_a + bornene + terpineol_4 + terpineol_a + terpinyl_ACT_a +'," . "' myrtenal + sabinene + pinene_b + camphene + fenchene_a + limonene + phellandrene_a + terpinene_a +'," @@ -2750,7 +2728,7 @@ if ($phys =~ /cam6/ or $phys =~ /cam7/) { add_default($nl, 'megan_factors_file'); add_default($nl, 'megan_mapped_emisfctrs', 'val'=>'.false.'); } - if ($chem =~ /trop_strat_mam4_ts2/ or $chem =~ /trop_strat_mam5_t2s1/) { + if ($chem =~ /trop_strat_mam4_ts2/ or $chem =~ /trop_strat_mam5_ts2/) { my $val = "'ISOP = isoprene'," . "'APIN = pinene_a + myrtenal'," . "'BPIN = carene_3 + thujene_a + bornene + fenchene_a + pinene_b + sabinene + camphene + terpineol_4 + terpineol_a + terpinyl_ACT_a'," @@ -3725,11 +3703,6 @@ if (!$simple_phys) { add_default($nl, 'do_iss'); } -# Sponge layer vertical diffusion -if (!$simple_phys) { - add_default($nl, 'diff_sponge_fac'); -} - # Convective water in radiation if (!$simple_phys) { add_default($nl, 'conv_water_in_rad'); @@ -3782,6 +3755,18 @@ if (!$simple_phys) { add_default($nl, 'zmconv_parcel_hscale'); } +# MCSP +if (!$simple_phys) { + add_default($nl, 'MCSP_heat_coeff'); + add_default($nl, 'MCSP_moisture_coeff'); + add_default($nl, 'MCSP_uwind_coeff'); + add_default($nl, 'MCSP_vwind_coeff'); + add_default($nl, 'MCSP_storm_speed_pref'); + add_default($nl, 'MCSP_conv_depth_min'); + add_default($nl, 'mcsp_shear_min'); +} + + # moist convection rainwater coefficients my $shallow_scheme = $nl->get_value('shallow_scheme'); $shallow_scheme =~ s/['"]//g; # strip quotes "' diff --git a/bld/namelist_files/namelist_defaults_cam.xml b/bld/namelist_files/namelist_defaults_cam.xml index 75acdede44..72455ff0ca 100644 --- a/bld/namelist_files/namelist_defaults_cam.xml +++ b/bld/namelist_files/namelist_defaults_cam.xml @@ -2891,6 +2891,15 @@ .false. 0.5 + + 0.0D0 + 0.0D0 + 0.0D0 + 0.0D0 +60000.0 +50000.0 + 3.0 + 1.0D0 diff --git a/bld/namelist_files/namelist_definition.xml b/bld/namelist_files/namelist_definition.xml index d767872618..6eb9509b21 100644 --- a/bld/namelist_files/namelist_definition.xml +++ b/bld/namelist_files/namelist_definition.xml @@ -3508,8 +3508,6 @@ Number of subcolumns in VAMP Generator Default: 10 - - + + + +MCSP heating coefficient controlling the tendency intensity added. +Default: 0.0 + + + +MCSP moistening coefficient controlling the tendency intensity added. +Default: 0.0 + + + +MCSP uwnd tendency coefficient controlling the tendency intensity added. +Default: 0.0 + + + +MCSP vwnd tendency coefficient controlling the tendency intensity added. +Default: 0.0 + + + +Reference pressure level in Pa for low-level zonal wind shear calculation for MCSP. +Default: 60000.0 + + + +Minimum convection depth for MCSP to be activated in Pa. +Default: 50000.0 + + + +Minimum uwind difference/shear between reference pressure level and surface for MCSP to be activated. +Default: 3.0 + + + + + shr_kind_r8 + use cam_abortutils, only: endrun + use cam_logfile, only: iulog + + + implicit none + private + + public :: mcsp_register ! Register fields wit the output buffer + public :: mcsp_readnl ! Read MCSP namelist + public :: mcsp_intr_init ! initialize MCSP namelist variables + public :: mcsp_tend ! Perform MCSP tendency calculations + + real(r8) :: MCSP_storm_speed_pref ! pressure level for winds in MCSP calculation [Pa] + real(r8) :: MCSP_conv_depth_min ! pressure thickness of convective heating [Pa] + real(r8) :: mcsp_shear_min ! min shear value for MCSP to be active + + real(r8) :: MCSP_heat_coeff ! heating coefficient for MCSP + real(r8) :: MCSP_moisture_coeff ! moisture coefficient for MCSP + real(r8) :: MCSP_uwind_coeff ! uwind coefficient for MCSP + real(r8) :: MCSP_vwind_coeff ! vwind coefficient for MCSP + +!========================================================================================= +contains +!========================================================================================= +subroutine mcsp_register() + !---------------------------------------------------------------------------- + ! Purpose: register MCSP output fields + !---------------------------------------------------------------------------- + use cam_history, only: addfld, horiz_only + !---------------------------------------------------------------------------- + call addfld('MCSP_DT_max', horiz_only, 'A', 'K/s', 'MCSP max T tendency') + call addfld('MCSP_DT', (/'lev'/), 'A', 'K/s', 'MCSP T tendency') + call addfld('MCSP_DQ', (/'lev'/), 'A', 'kg/kg/s', 'MCSP qv tendency') + call addfld('MCSP_DU', (/'lev'/), 'A', 'm/s/day', 'MCSP U wind tendency') + call addfld('MCSP_DV', (/'lev'/), 'A', 'm/s/day', 'MCSP V wind tendency') + + call addfld('MCSP_freq', horiz_only, 'A', '1', 'MCSP frequency of activation') + call addfld('MCSP_shear', horiz_only, 'A', 'm/s', 'MCSP vertical shear of zonal wind') + call addfld('MCSP_conv_depth', horiz_only, 'A', 'Pa', 'ZM convection depth for MCSP') + +end subroutine mcsp_register + +!========================================================================================= + +subroutine mcsp_readnl(nlfile) + + use spmd_utils, only: mpicom, masterproc, masterprocid, mpi_real8, mpi_integer, mpi_logical + use namelist_utils, only: find_group_name + + character(len=*), intent(in) :: nlfile ! filepath for file containing namelist input + + ! Local variables + integer :: unitn, ierr + character(len=*), parameter :: subname = 'mcsp_readnl' + + namelist /mcsp_nl/ MCSP_heat_coeff, MCSP_moisture_coeff, & + MCSP_uwind_coeff, MCSP_vwind_coeff, & + MCSP_storm_speed_pref, MCSP_conv_depth_min, mcsp_shear_min + !----------------------------------------------------------------------------- + + if (masterproc) then + open( newunit=unitn, file=trim(nlfile), status='old' ) + call find_group_name(unitn, 'mcsp_nl', status=ierr) + if (ierr == 0) then + read(unitn, mcsp_nl, iostat=ierr) + if (ierr /= 0) then + call endrun(subname // ':: ERROR reading namelist') + end if + end if + close(unitn) + + end if + + ! Broadcast namelist variables + call mpi_bcast(MCSP_heat_coeff, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_heat_coeff") + call mpi_bcast(MCSP_moisture_coeff, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_moisture_coeff") + call mpi_bcast(MCSP_uwind_coeff, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_uwind_coeff") + call mpi_bcast(MCSP_vwind_coeff, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_vwind_coeff") + call mpi_bcast(MCSP_storm_speed_pref, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_storm_speed_pref") + call mpi_bcast(MCSP_conv_depth_min, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: MCSP_conv_depth_min") + call mpi_bcast(mcsp_shear_min, 1, mpi_real8, masterprocid, mpicom, ierr) + if (ierr /= 0) call endrun("mcsp_readnl: FATAL: mpi_bcast: mcsp_shear_min") + +end subroutine mcsp_readnl + +!=================================================================================================== + +subroutine mcsp_intr_init() + use MCSP, only: MCSP_init + use spmd_utils, only: masterproc + use cam_logfile, only: iulog + + implicit none + + call MCSP_init(MCSP_heat_coeff, MCSP_moisture_coeff, MCSP_uwind_coeff, MCSP_vwind_coeff, & + MCSP_storm_speed_pref, MCSP_conv_depth_min, mcsp_shear_min, masterproc, iulog) + +end subroutine mcsp_intr_init + +!=================================================================================================== + +subroutine mcsp_tend( state, ptend, ztodt, jctop, tend_t, tend_q ) + + use MCSP, only: MCSP_run + use physconst, only: cpair + use physics_types, only: physics_state, physics_ptend, physics_ptend_init + use ppgrid, only: pver, pverp, pcols + use physconst, only: cpair, pi + use constituents, only: pcnst + + ! Arguments + type(physics_state), intent( in) :: state ! Physics state variables + type(physics_ptend), intent(out) :: ptend ! individual parameterization tendencies + real(r8), intent(in ) :: ztodt ! 2x physics time step + integer, dimension(pcols), intent(in ) :: jctop ! cloud top level indices + real(r8), dimension(pcols,pver), intent(in ) :: tend_t ! input deep convective temperature tendency + real(r8), dimension(pcols,pver), intent(in ) :: tend_q ! input deep convective tendency for specific humidity (qv) + + ! local variables + integer :: lchnk ! chunk identifier + integer :: ncol ! number of atmospheric columns (actual) + real(r8), dimension(pcols,pver) :: mcsp_dt_out! final MCSP tendency for DSE + real(r8), dimension(pcols,pver) :: mcsp_dq_out! final MCSP tendency for qv + real(r8), dimension(pcols,pver) :: mcsp_du_out! final MCSP tendency for u wind + real(r8), dimension(pcols,pver) :: mcsp_dv_out! final MCSP tendency for v wind + real(r8), dimension(pcols) :: mcsp_freq ! MSCP frequency for output + real(r8), dimension(pcols) :: mcsp_shear ! shear used to check against threshold + real(r8), dimension(pcols) :: conv_depth ! pressure depth of deep convection + real(r8), dimension(pcols) :: mcsp_tend_s_max ! max MCSP heating tendency + logical :: lq(pcnst) + + !---------------------------------------------------------------------------- + ! Perform MCSP tendency calculations + !---------------------------------------------------------------------------- + lchnk = state%lchnk + ncol = state%ncol + lq(:) = .false. + lq(1) = .true. + + call physics_ptend_init(ptend, state%psetcols, 'MCSP', ls = .true., lq = lq, lu = .true., lv = .true.) + + call MCSP_run( pcols, ncol, pver, pverp, cpair, pi, & + ztodt, jctop, & + state%pmid, state%pint, state%pdel, & + state%s, state%q(:,:,1), state%u, state%v, & + tend_t, tend_q, & + ptend%s, ptend%q(:,:,1), ptend%u, ptend%v, & + mcsp_dt_out, mcsp_dq_out, mcsp_du_out, mcsp_dv_out, & + mcsp_freq, mcsp_shear, conv_depth, mcsp_tend_s_max ) + + !---------------------------------------------------------------------------- + ! outpuf MCSP variables + !---------------------------------------------------------------------------- + call mcsp_hist( lchnk, pcols, pver, & + mcsp_dt_out, mcsp_dq_out, mcsp_du_out, mcsp_dv_out, & + mcsp_freq, mcsp_shear, conv_depth, mcsp_tend_s_max ) + +end subroutine mcsp_tend + +!=================================================================================================== + +subroutine mcsp_hist( lchnk, pcols, pver, & + mcsp_dt_out, mcsp_dq_out, mcsp_du_out, mcsp_dv_out, & + mcsp_freq, mcsp_shear, conv_depth, mcsp_tend_s_max ) + !---------------------------------------------------------------------------- + ! Purpose: write diagnostic quantities to history files + !---------------------------------------------------------------------------- + use cam_history, only: outfld + !---------------------------------------------------------------------------- + ! Arguments + integer, intent(in) :: lchnk ! chunk identifier + integer, intent(in) :: pcols ! number of atmospheric columns (max) + integer, intent(in) :: pver ! number of mid-point vertical levels + real(r8), dimension(pcols,pver), intent(in) :: mcsp_dt_out ! final MCSP tendency for DSE + real(r8), dimension(pcols,pver), intent(in) :: mcsp_dq_out ! final MCSP tendency for qv + real(r8), dimension(pcols,pver), intent(in) :: mcsp_du_out ! final MCSP tendency for u wind + real(r8), dimension(pcols,pver), intent(in) :: mcsp_dv_out ! final MCSP tendency for v wind + real(r8), dimension(pcols), intent(in) :: mcsp_freq ! MSCP frequency for output + real(r8), dimension(pcols), intent(in) :: mcsp_shear ! shear used to check against threshold + real(r8), dimension(pcols), intent(in) :: conv_depth ! pressure depth of ZM heating + real(r8), dimension(pcols), intent(in) :: mcsp_tend_s_max ! max MCSP heating tendency + !---------------------------------------------------------------------------- + ! write out MCSP diagnostic history fields + call outfld('MCSP_DT', mcsp_dt_out, pcols, lchnk ) + call outfld('MCSP_DQ', mcsp_dq_out, pcols, lchnk ) + call outfld('MCSP_DU', mcsp_du_out, pcols, lchnk ) + call outfld('MCSP_DV', mcsp_dv_out, pcols, lchnk ) + call outfld('MCSP_freq', mcsp_freq, pcols, lchnk ) + call outfld('MCSP_shear', mcsp_shear, pcols, lchnk ) + call outfld('MCSP_conv_depth', conv_depth, pcols, lchnk ) + call outfld('MCSP_DT_max', mcsp_tend_s_max, pcols, lchnk) + !---------------------------------------------------------------------------- + return + +end subroutine mcsp_hist + +!=================================================================================================== + +end module mcsp_intr + + diff --git a/src/physics/cam/physpkg.F90 b/src/physics/cam/physpkg.F90 index ad0837ea9b..c08d77962a 100644 --- a/src/physics/cam/physpkg.F90 +++ b/src/physics/cam/physpkg.F90 @@ -137,6 +137,9 @@ subroutine phys_register use ghg_data, only: ghg_data_register use vertical_diffusion, only: vd_register use convect_deep, only: convect_deep_register + !++ MCSP + use mcsp_intr, only: mcsp_register + !-- MCSP use convect_shallow, only: convect_shallow_register use radiation, only: radiation_register use co2_cycle, only: co2_register @@ -315,6 +318,9 @@ subroutine phys_register ! deep convection call convect_deep_register + !MCSP + call mcsp_register() + ! shallow convection call convect_shallow_register @@ -733,6 +739,9 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use cldfrc2m, only: cldfrc2m_init use co2_cycle, only: co2_init, co2_transport use convect_deep, only: convect_deep_init + !++ MCSP + use mcsp_intr, only: mcsp_intr_init + !-- MCSP use convect_shallow, only: convect_shallow_init use constituents, only: cnst_get_ind use cam_diagnostics, only: diag_init @@ -921,6 +930,10 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call convect_deep_init(pref_edge) + !++ MCSP + call mcsp_intr_init() + !-- MCSP + if( microp_scheme == 'RK' ) then call rk_stratiform_cam_init() elseif( microp_scheme == 'MG' ) then @@ -1411,7 +1424,7 @@ subroutine tphysac (ztodt, cam_in, & use dycore, only: dycore_is use cam_control_mod, only: aqua_planet use mo_gas_phase_chemdr,only: map2chm - use clybryiy_fam, only: clybryiy_fam_set + use clybry_fam, only: clybry_fam_set use charge_neutrality, only: charge_balance use qbo, only: qbo_relax use iondrag, only: iondrag_calc, do_waccm_ions @@ -2073,7 +2086,7 @@ subroutine tphysac (ztodt, cam_in, & call diag_phys_tend_writeout (state, pbuf, tend, ztodt, qini, cldliqini, cldiceini) - call clybryiy_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) + call clybry_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) ! clean CARMA diagnostics object if (associated(carma_diags_obj)) then @@ -2158,7 +2171,7 @@ subroutine tphysbc (ztodt, state, & use cloud_diagnostics, only: cloud_diagnostics_calc use perf_mod use mo_gas_phase_chemdr,only: map2chm - use clybryiy_fam, only: clybryiy_fam_adj + use clybry_fam, only: clybry_fam_adj use clubb_intr, only: clubb_tend_cam use sslt_rebin, only: sslt_rebin_adv use tropopause, only: tropopause_output @@ -2176,6 +2189,14 @@ subroutine tphysbc (ztodt, state, & use dyn_tests_utils, only: vc_dycore use surface_emissions_mod,only: surface_emissions_set use elevated_emissions_mod,only: elevated_emissions_set + !++ MCSP + use mcsp_intr, only: mcsp_tend + use save_ttend_from_convect_deep, only : save_ttend_from_convect_deep_timestep_init, save_ttend_from_convect_deep_run + use save_qtend_from_convect_deep, only : save_qtend_from_convect_deep_timestep_init, save_qtend_from_convect_deep_run + use zm_conv_intr, only: ttend_s + use convect_deep, only: jctop1 + use physconst, only: cpair + !-- MCSP ! Arguments @@ -2213,6 +2234,12 @@ subroutine tphysbc (ztodt, state, & real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections real(r8) rtdt ! 1./ztodt + !++ MCSP + real(r8) ttend_dp(pcols,pver) ! temperature tendency from deep convection + real(r8) qtend_dp(pcols,pver) ! water vapor from deep convection + character(len=512) :: errmsg + integer :: errflg + !-- MCSP integer lchnk ! chunk identifier integer ncol ! number of atmospheric columns @@ -2337,16 +2364,16 @@ subroutine tphysbc (ztodt, state, & if (state_debug_checks) & call physics_state_check(state, name="before tphysbc (dycore?)") - call clybryiy_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) + call clybry_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) - ! Since clybryiy_fam_adj operates directly on the tracers, and has no + ! Since clybry_fam_adj operates directly on the tracers, and has no ! physics_update call, re-run qneg3. call qneg3('TPHYSBCc',lchnk ,ncol ,pcols ,pver , & 1, pcnst, qmin ,state%q ) - ! Validate output of clybryiy_fam_adj. + ! Validate output of clybry_fam_adj. if (state_debug_checks) & - call physics_state_check(state, name="clybryiy_fam_adj") + call physics_state_check(state, name="clybry_fam_adj") ! ! Dump out "before physics" state @@ -2454,6 +2481,11 @@ subroutine tphysbc (ztodt, state, & flx_heat, cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) end if + !++ MCSP + call save_ttend_from_convect_deep_timestep_init(ncol, pver, ttend_dp, errmsg, errflg) + call save_qtend_from_convect_deep_timestep_init(ncol, pver, qtend_dp, errmsg, errflg) + !-- MCSP + call convect_deep_tend( & cmfmc, cmfcme, & zdu, & @@ -2461,6 +2493,11 @@ subroutine tphysbc (ztodt, state, & ztodt, & state, ptend, cam_in%landfrac, pbuf) + !++ MCSP + call save_ttend_from_convect_deep_run(ncol, pver, ttend_s, cpair, ttend_dp, errmsg, errflg) + call save_qtend_from_convect_deep_run(ncol, pver, ptend%q(:,:,1), qtend_dp, errmsg, errflg) + !-- MCSP + if ( (trim(cam_take_snapshot_after) == "convect_deep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then call cam_snapshot_ptend_outfld(ptend, lchnk) @@ -2481,6 +2518,26 @@ subroutine tphysbc (ztodt, state, & call t_stopf('convect_deep_tend') + !++ MCSP + call t_startf ('MCSP_tend') + + if (trim(cam_take_snapshot_before) == "mcsp_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call mcsp_tend( state, ptend, ztodt, jctop1, ttend_dp, qtend_dp) + + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "mcsp_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + flx_heat, cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, det_s, det_ice, net_flx) + end if + + call t_stopf('MCSP_tend') + !-- MCSP + call pbuf_get_field(pbuf, prec_dp_idx, prec_dp ) call pbuf_get_field(pbuf, snow_dp_idx, snow_dp ) call pbuf_get_field(pbuf, prec_sh_idx, prec_sh ) @@ -3102,6 +3159,15 @@ subroutine phys_timestep_init(phys_state, cam_in, cam_out, pbuf2d) use phys_grid_ctem, only: phys_grid_ctem_diags use surface_emissions_mod,only: surface_emissions_adv use elevated_emissions_mod,only: elevated_emissions_adv + !++ MCSP + use mcsp_intr, only: mcsp_tend + use save_ttend_from_convect_deep, only : save_ttend_from_convect_deep_timestep_init, save_ttend_from_convect_deep_run + use save_qtend_from_convect_deep, only : save_qtend_from_convect_deep_timestep_init, save_qtend_from_convect_deep_run + use zm_conv_intr, only: ttend_s + use convect_deep, only: jctop1 + use physconst, only: cpair + !-- MCSP + implicit none diff --git a/src/physics/cam/zm_conv_intr.F90 b/src/physics/cam/zm_conv_intr.F90 index 6a4f9d8cfa..6f7789d000 100644 --- a/src/physics/cam/zm_conv_intr.F90 +++ b/src/physics/cam/zm_conv_intr.F90 @@ -40,6 +40,12 @@ module zm_conv_intr zm_conv_tend, &! return tendencies zm_conv_tend_2 ! return tendencies + !++ MCSP + public :: ttend_s + + real(r8) :: ttend_s(pcols,pver) + !-- MCSP + public zmconv_ke, zmconv_ke_lnd ! needed by convect_shallow integer ::& ! indices for fields in the physics buffer @@ -593,6 +599,10 @@ subroutine zm_conv_tend(pblh ,mcon ,cme , & end do call outfld('CAPE', cape, pcols, lchnk) ! RBN - CAPE output + + !++ MCSP + ttend_s = ptend_loc%s(:pcols,:) + !-- MCSP ! ! Output fractional occurance of ZM convection ! diff --git a/src/physics/cam7/physpkg.F90 b/src/physics/cam7/physpkg.F90 index a3f0c49fe6..06daae3b82 100644 --- a/src/physics/cam7/physpkg.F90 +++ b/src/physics/cam7/physpkg.F90 @@ -133,6 +133,9 @@ subroutine phys_register use ghg_data, only: ghg_data_register use vertical_diffusion, only: vd_register use convect_deep, only: convect_deep_register + !++ MCSP + use mcsp_intr, only: mcsp_register + !-- MCSP use convect_diagnostics,only: convect_diagnostics_register use radiation, only: radiation_register use co2_cycle, only: co2_register @@ -305,6 +308,9 @@ subroutine phys_register ! deep convection call convect_deep_register + !MCSP + call mcsp_register() + ! convection diagnostics call convect_diagnostics_register @@ -731,6 +737,9 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) use cldfrc2m, only: cldfrc2m_init use co2_cycle, only: co2_init, co2_transport use convect_deep, only: convect_deep_init + !++ MCSP + use mcsp_intr, only: mcsp_intr_init + !-- MCSP use convect_diagnostics,only: convect_diagnostics_init use cam_diagnostics, only: diag_init use gw_drag_cam, only: gw_drag_cam_init @@ -917,6 +926,10 @@ subroutine phys_init( phys_state, phys_tend, pbuf2d, cam_in, cam_out ) call convect_deep_init(pref_edge) + !++ MCSP + call mcsp_intr_init() + !-- MCSP + if (.not. do_clubb_sgs) call macrop_driver_init(pbuf2d) call microp_aero_init(phys_state,pbuf2d) call microp_driver_init(pbuf2d) @@ -1402,7 +1415,7 @@ subroutine tphysac (ztodt, cam_in, & use dycore, only: dycore_is use cam_control_mod, only: aqua_planet use mo_gas_phase_chemdr,only: map2chm - use clybryiy_fam, only: clybryiy_fam_set + use clybry_fam, only: clybry_fam_set use charge_neutrality, only: charge_balance use qbo, only: qbo_relax use iondrag, only: iondrag_calc, do_waccm_ions @@ -1487,6 +1500,7 @@ subroutine tphysac (ztodt, cam_in, & real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections real(r8) rtdt ! 1./ztodt + real(r8) :: rliq(pcols) ! vertical integral of liquid not yet in q(ixcldliq) real(r8) :: det_s (pcols) ! vertical integral of detrained static energy from ice real(r8) :: det_ice(pcols) ! vertical integral of detrained ice @@ -2556,7 +2570,7 @@ subroutine tphysac (ztodt, cam_in, & call diag_phys_tend_writeout (state, pbuf, tend, ztodt, qini, cldliqini, cldiceini) - call clybryiy_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) + call clybry_fam_set( ncol, lchnk, map2chm, state%q, pbuf ) ! output these here -- after updates by chem_timestep_tend or export_fields within the current time step if (associated(cam_out%nhx_nitrogen_flx)) then @@ -2620,7 +2634,7 @@ subroutine tphysbc (ztodt, state, & use radiation, only: radiation_tend use perf_mod use mo_gas_phase_chemdr,only: map2chm - use clybryiy_fam, only: clybryiy_fam_adj + use clybry_fam, only: clybry_fam_adj use cam_abortutils, only: endrun use subcol_utils, only: is_subcol_on use qneg_module, only: qneg3 @@ -2629,6 +2643,14 @@ subroutine tphysbc (ztodt, state, & use dyn_tests_utils, only: vc_dycore use surface_emissions_mod,only: surface_emissions_set use elevated_emissions_mod,only: elevated_emissions_set + !++ MCSP + use mcsp_intr, only: mcsp_tend + use save_ttend_from_convect_deep, only : save_ttend_from_convect_deep_timestep_init, save_ttend_from_convect_deep_run + use save_qtend_from_convect_deep, only : save_qtend_from_convect_deep_timestep_init, save_qtend_from_convect_deep_run + use zm_conv_intr, only: ttend_s + use convect_deep, only: jctop1 + use physconst, only: cpair + !-- MCSP ! Arguments @@ -2660,6 +2682,12 @@ subroutine tphysbc (ztodt, state, & real(r8) dlf(pcols,pver) ! Detraining cld H20 from shallow + deep convections real(r8) dlf2(pcols,pver) ! Detraining cld H20 from shallow convections real(r8) rtdt ! 1./ztodt + !++ MCSP + real(r8) ttend_dp(pcols,pver) ! temperature tendency from deep convection + real(r8) qtend_dp(pcols,pver) ! water vapor from deep convection + character(len=512) :: errmsg + integer :: errflg + !-- MCSP integer lchnk ! chunk identifier integer ncol ! number of atmospheric columns @@ -2767,16 +2795,16 @@ subroutine tphysbc (ztodt, state, & call physics_state_check(state, name="before tphysbc (dycore?)") end if - call clybryiy_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) + call clybry_fam_adj( ncol, lchnk, map2chm, state%q, pbuf ) - ! Since clybryiy_fam_adj operates directly on the tracers, and has no + ! Since clybry_fam_adj operates directly on the tracers, and has no ! physics_update call, re-run qneg3. call qneg3('TPHYSBCc',lchnk ,ncol ,pcols ,pver , & 1, pcnst, qmin ,state%q ) - ! Validate output of clybryiy_fam_adj. + ! Validate output of clybry_fam_adj. if (state_debug_checks) then - call physics_state_check(state, name="clybryiy_fam_adj") + call physics_state_check(state, name="clybry_fam_adj") end if ! ! Dump out "before physics" state @@ -2884,6 +2912,11 @@ subroutine tphysbc (ztodt, state, & cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, net_flx) end if + !++ MCSP + call save_ttend_from_convect_deep_timestep_init(ncol, pver, ttend_dp, errmsg, errflg) + call save_qtend_from_convect_deep_timestep_init(ncol, pver, qtend_dp, errmsg, errflg) + !-- MCSP + call convect_deep_tend( & cmfmc, cmfcme, & zdu, & @@ -2891,6 +2924,11 @@ subroutine tphysbc (ztodt, state, & ztodt, & state, ptend, cam_in%landfrac, pbuf) + !++ MCSP + call save_ttend_from_convect_deep_run(ncol, pver, ttend_s, cpair, ttend_dp, errmsg, errflg) + call save_qtend_from_convect_deep_run(ncol, pver, ptend%q(:,:,1), qtend_dp, errmsg, errflg) + !-- MCSP + if ( (trim(cam_take_snapshot_after) == "convect_deep_tend") .and. & (trim(cam_take_snapshot_before) == trim(cam_take_snapshot_after))) then call cam_snapshot_ptend_outfld(ptend, lchnk) @@ -2911,6 +2949,26 @@ subroutine tphysbc (ztodt, state, & call t_stopf('convect_deep_tend') + !++ MCSP + call t_startf ('MCSP_tend') + if (trim(cam_take_snapshot_before) == "mcsp_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_before_num, state, tend, cam_in, cam_out, pbuf, & + cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, net_flx) + end if + + call mcsp_tend( state, ptend, ztodt, jctop1, ttend_dp, qtend_dp) + + call physics_update(state, ptend, ztodt, tend) + + if (trim(cam_take_snapshot_after) == "mcsp_tend") then + call cam_snapshot_all_outfld_tphysbc(cam_snapshot_after_num, state, tend, cam_in, cam_out, pbuf, & + cmfmc, cmfcme, zdu, rliq, rice, dlf, dlf2, rliq2, net_flx) + end if + + call t_stopf('MCSP_tend') + !-- MCSP + + call pbuf_get_field(pbuf, prec_dp_idx, prec_dp ) call pbuf_get_field(pbuf, snow_dp_idx, snow_dp ) call pbuf_get_field(pbuf, prec_sh_idx, prec_sh )