eagles-project / mam4xx

A C++ implementation of MAM4
https://eagles-project.github.io/mam4xx/
Other
6 stars 6 forks source link

Repeated use of model index while fetching mixing ratios. #326

Open singhbalwinder opened 4 months ago

singhbalwinder commented 4 months ago

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.