Skip to content

Commit

Permalink
bail if the primary species isn't defined (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale authored Nov 22, 2021
1 parent 4246ae0 commit eadaf26
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions unit_test/react_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,26 @@ init_t setup_composition(const int nz) {

comp_data.nprim = 0;

// we absolutely require primary_species_1 to be defined
comp_data.is1 = network_spec_index(primary_species_1);
if (comp_data.is1 >= 0) {
comp_data.nprim++;
} else {
amrex::Error("Error: invalid primary_species_1");
}

// we'll check the next species, but if it is not valid,
// we'll just move on
comp_data.is2 = network_spec_index(primary_species_2);
if (comp_data.is2 >= 0) {
comp_data.nprim++;
}

comp_data.is3 = network_spec_index(primary_species_3);
if (comp_data.is3 >= 0) {
comp_data.nprim++;
// only consider primary_species_3 if primary_species_2
// was defined
comp_data.is3 = network_spec_index(primary_species_3);
if (comp_data.is3 >= 0) {
comp_data.nprim++;
}
}

if (comp_data.nprim == 0) {
Expand Down

0 comments on commit eadaf26

Please sign in to comment.