Skip to content

Commit

Permalink
Adds fsds input for gas drydep
Browse files Browse the repository at this point in the history
  • Loading branch information
singhbalwinder committed Nov 22, 2024
1 parent 6d6a8e9 commit 04891b8
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ void MAMMicrophysics::set_grids(
// snow depth land [m]
add_field<Required>("snow_depth_land", scalar2d, m, grid_name);

//----------- Variables from the RRTMGP radiation ---------
// Downwelling solar flux at the surface [w/m2]
add_field<Required>("SW_flux_dn", scalar3d_int, W / m2, grid_name);

// ---------------------------------------------------------------------
// These variables are "updated" or inputs/outputs for the process
// ---------------------------------------------------------------------
Expand Down Expand Up @@ -611,6 +615,10 @@ void MAMMicrophysics::run_impl(const double dt) {
const const_view_2d fraction_landuse =
get_field_in("fraction_landuse").get_view<const Real **>();

// Downwelling solar flux at the surface [w/m2]
const const_view_2d sw_flux_dn =
get_field_in("SW_flux_dn").get_view<const Real **>();

// Surface temperature [K]
const const_view_1d sfc_temperature =
get_field_in("surf_radiative_T").get_view<const Real *>();
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand All @@ -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));
Expand All @@ -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) {
Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down

0 comments on commit 04891b8

Please sign in to comment.