eagles-project/mam4xx

Repeated use of model index while fetching mixing ratios.

Opened this issue · 0 comments

For getting mixing ratios of a particular species, we sometimes use the index information twice. For example the following code in src/mam4xx/hetfrz.hpp:

const int accum_idx = int(ModeIndex::Accumulation);
  const int pcarbon_idx = int(ModeIndex::PrimaryCarbon);

  auto &accum_bc  = progs.q_aero_i[accum_idx][aerosol_index_for_mode(ModeIndex::Accumulation, AeroId::BC)];

The code above uses ModeIndex::Accumulation twice. We should look into ways to avoid its repeated use.