From 04891b8480876ef20fecd5faf05a6dd628b2b97d Mon Sep 17 00:00:00 2001 From: Balwinder Singh Date: Thu, 21 Nov 2024 16:10:31 -0800 Subject: [PATCH] Adds fsds input for gas drydep --- ...mxx_mam_microphysics_process_interface.cpp | 51 ++++++++++--------- .../mam/aero_microphys/input.yaml | 1 + 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp index 86f5baff5f67..02531748d319 100644 --- a/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp +++ b/components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp @@ -174,6 +174,10 @@ void MAMMicrophysics::set_grids( // snow depth land [m] add_field("snow_depth_land", scalar2d, m, grid_name); + //----------- Variables from the RRTMGP radiation --------- + // Downwelling solar flux at the surface [w/m2] + add_field("SW_flux_dn", scalar3d_int, W / m2, grid_name); + // --------------------------------------------------------------------- // These variables are "updated" or inputs/outputs for the process // --------------------------------------------------------------------- @@ -611,6 +615,10 @@ void MAMMicrophysics::run_impl(const double dt) { const const_view_2d fraction_landuse = get_field_in("fraction_landuse").get_view(); + // Downwelling solar flux at the surface [w/m2] + const const_view_2d sw_flux_dn = + get_field_in("SW_flux_dn").get_view(); + // Surface temperature [K] const const_view_1d sfc_temperature = get_field_in("surf_radiative_T").get_view(); @@ -787,8 +795,10 @@ void MAMMicrophysics::run_impl(const double dt) { } const mam4::seq_drydep::Data drydep_data = mam4::seq_drydep::set_gas_drydep_data(); - const auto qv = wet_atm_.qv; - const int month = timestamp().get_month(); // 1-based + const auto qv = wet_atm_.qv; + const int month = timestamp().get_month(); // 1-based + const int surface_lev = nlev - 1; // Surface level + // loop over atmosphere columns and compute aerosol microphyscs Kokkos::parallel_for( "MAMMicrophysics::run_impl", policy, @@ -856,9 +866,6 @@ void MAMMicrophysics::run_impl(const double dt) { const auto linoz_cariolle_pscs_icol = ekat::subview(linoz_cariolle_pscs, icol); - // Surface level - const int surface_lev = nlev - 1; - // Surface temperature const Real sfc_air_temp = atm.temperature(surface_lev); @@ -873,7 +880,7 @@ void MAMMicrophysics::run_impl(const double dt) { // Surface pressure at 10m (Followed the fortran code) const Real pressure_10m = dry_atm.p_mid(icol, surface_lev); - // wind speed at the surface + // Wind speed at the surface const Real wind_speed = haero::sqrt(u_wind(icol, surface_lev) * u_wind(icol, surface_lev) + v_wind(icol, surface_lev) * v_wind(icol, surface_lev)); @@ -882,10 +889,11 @@ void MAMMicrophysics::run_impl(const double dt) { const Real rain = precip_liq_surf_mass(icol, surface_lev) + precip_ice_surf_mass(icol, surface_lev); - const Real snow_height = - snow_depth_land(icol); // total precip - rain ? - const Real solar_flux = - 1.0; // ????? FIXME: I am not sure where to get this field yet + // Snow depth on land [m] + const Real snow_height = snow_depth_land(icol); + + // Downwelling solar flux at the surface (value at interface) [w/m2] + const Real solar_flux = sw_flux_dn(icol, surface_lev + 1); Real fraction_landuse_icol[n_land_type]; for(int i = 0; i < n_land_type; ++i) { @@ -904,20 +912,15 @@ void MAMMicrophysics::run_impl(const double dt) { mam4::microphysics::perform_atmospheric_chemistry_and_microphysics( team, dt, rlats, month, sfc_temperature(icol), sfc_air_temp, sfc_potential_temp, sfc_pressure(icol), pressure_10m, sfc_spec_hum, - wind_speed, rain, snow_height, - - solar_flux, // FIXME: Find matching variable for solar flux from - // EAMxx - - cnst_offline_icol, forcings_in, atm, photo_table, chlorine_loading, - config.setsox, config.amicphys, config.linoz.psc_T, - zenith_angle(icol), d_sfc_alb_dir_vis(icol), o3_col_dens_i, - photo_rates_icol, extfrc_icol, invariants_icol, - work_photo_table_icol, linoz_o3_clim_icol, linoz_t_clim_icol, - linoz_o3col_clim_icol, linoz_PmL_clim_icol, linoz_dPmL_dO3_icol, - linoz_dPmL_dT_icol, linoz_dPmL_dO3col_icol, - linoz_cariolle_pscs_icol, eccf, adv_mass_kg_per_moles, - fraction_landuse_icol, + wind_speed, rain, snow_height, solar_flux, cnst_offline_icol, + forcings_in, atm, photo_table, chlorine_loading, config.setsox, + config.amicphys, config.linoz.psc_T, zenith_angle(icol), + d_sfc_alb_dir_vis(icol), o3_col_dens_i, photo_rates_icol, + extfrc_icol, invariants_icol, work_photo_table_icol, + linoz_o3_clim_icol, linoz_t_clim_icol, linoz_o3col_clim_icol, + linoz_PmL_clim_icol, linoz_dPmL_dO3_icol, linoz_dPmL_dT_icol, + linoz_dPmL_dO3col_icol, linoz_cariolle_pscs_icol, eccf, + adv_mass_kg_per_moles, fraction_landuse_icol, col_index_season, // FIXME: Get it after Changes sync with E3SM diff --git a/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml b/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml index d016ffe51a8c..20e362b9acf6 100644 --- a/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml +++ b/components/eamxx/tests/single-process/mam/aero_microphys/input.yaml @@ -65,6 +65,7 @@ initial_conditions: precip_ice_surf_mass: 0.1 snow_depth_land: 0.01 fraction_landuse: [0.5, 0.5, 0.5, 0.5, 0.5, 0.2, 0.0, 0.0, 0.0, 0.2, 0.2] + SW_flux_dn: 500.0 # The parameters for I/O control Scorpio: output_yaml_files: ["output.yaml"]