Skip to content

Commit

Permalink
Adds assert statements and removes mmr variable
Browse files Browse the repository at this point in the history
  • Loading branch information
singhbalwinder committed Nov 23, 2024
1 parent 80a9013 commit 29c29a5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 16 additions & 1 deletion src/mam4xx/mo_drydep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ inline void find_season_index_at_lat(const Real clat_j,
}
} // i
EKAT_KERNEL_ASSERT_MSG(pos_min > -1,
"Error: dvel_inti: cannot find index.\n");
"Error in mo_drydep: dvel_inti: cannot find index.\n");
/* specify the season as the most frequent in the 11 vegetation classes
! this was done to remove a banding problem in dvel (JFL Oct 04)*/
// BAD CONSTANT
Expand Down Expand Up @@ -159,6 +159,8 @@ void calculate_uustar(
// find the constant velocity uu*=(u_i)(u*_i)
//-------------------------------------------------------------------------------------
z0b = haero::exp(z0b);
EKAT_KERNEL_ASSERT_MSG(
zl > 0, "Error in mo_drydep: cvarb: zl must be a positive number\n");
Real cvarb = karman / log(zl / z0b);

//-------------------------------------------------------------------------------------
Expand Down Expand Up @@ -361,6 +363,13 @@ void calculate_resistance_rgsx_and_rsmx(
rmx = 1.0 / (heff[idx_drydep] / 3000.0 + 100.0 * foxd(idx_drydep));
}
cts = 1000.0 * haero::exp(-tc - 4.0); // correction for frost

EKAT_KERNEL_ASSERT_MSG(
rgss(sndx, lt) != 0,
"Error in mo_drydep: rgss should be non-zero\n");
EKAT_KERNEL_ASSERT_MSG(
rgso(sndx, lt) != 0,
"Error in mo_drydep: rgso should be non-zero\n");
rgsx[ispec][lt] =
cts + 1.0 / ((heff[idx_drydep] / (1e5 * rgss(sndx, lt))) +
(foxd[idx_drydep] / rgso(sndx, lt)));
Expand Down Expand Up @@ -699,9 +708,15 @@ void drydep_xactive(
//-------------------------------------------------------------------------------------
// height of 1st level
//-------------------------------------------------------------------------------------

EKAT_KERNEL_ASSERT_MSG(pressure_sfc > pressure_10m,
"Error in mo_drydep: Surface pressure (pressure_sfc) "
"should be > pressure_10m\n");
// BAD_CONSTANTS
Real zl = -rair / grav * air_temp * (1. + 0.61 * spec_hum) *
log(pressure_10m / pressure_sfc);
EKAT_KERNEL_ASSERT_MSG(zl > 0,
"Error in mo_drydep: zl must be a positive number\n");

//-------------------------------------------------------------------------------------
// wind speed
Expand Down
4 changes: 2 additions & 2 deletions src/mam4xx/mo_gas_phase_chemdr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void perform_atmospheric_chemistry_and_microphysics(
const View1D &linoz_PmL_clim_icol, const View1D &linoz_dPmL_dO3_icol,
const View1D &linoz_dPmL_dT_icol, const View1D &linoz_dPmL_dO3col_icol,
const View1D &linoz_cariolle_pscs_icol, const Real eccf,
const Real adv_mass_kg_per_moles[gas_pcnst], const Real mmr[gas_pcnst],
const Real adv_mass_kg_per_moles[gas_pcnst],
const Real fraction_landuse[mam4::mo_drydep::n_land_type],
const int col_index_season[mam4::mo_drydep::n_land_type],
const int (&clsmap_4)[gas_pcnst], const int (&permute_4)[gas_pcnst],
Expand Down Expand Up @@ -384,7 +384,7 @@ void perform_atmospheric_chemistry_and_microphysics(
rain, // rain content [??]
snow, // snow height [m]
solar_flux, // direct shortwave surface radiation [W/m^2]
mmr, // constituent MMRs [kg/kg]
qq, // constituent MMRs [kg/kg]
dvel, // deposition velocity [1/cm/s]
dflx // deposition flux [1/cm^2/s]
);
Expand Down

0 comments on commit 29c29a5

Please sign in to comment.