@@ -537,15 +537,15 @@ void AtmosphereDriver::create_fields()
537
537
// Before registering fields, check that Field Requests for tracers are compatible
538
538
{
539
539
// Create map from tracer name to a vector which contains the field requests for that tracer.
540
- std::map<std::string, std::vector <FieldRequest>> tracer_requests;
540
+ std::map<std::string, std::set <FieldRequest>> tracer_requests;
541
541
auto gather_tracer_requests = [&] (FieldRequest req) {
542
542
if (not ekat::contains (req.groups , " tracers" )) return ;
543
543
544
544
std::string fname = req.fid .name ();
545
545
if (tracer_requests.find (fname) == tracer_requests.end ()) {
546
- tracer_requests[fname] = std::vector<FieldRequest>( 1 , req) ;
546
+ tracer_requests[fname] = { req} ;
547
547
} else {
548
- tracer_requests[fname].push_back (req);
548
+ tracer_requests[fname].emplace (req);
549
549
}
550
550
};
551
551
for (const auto & req : m_atm_process_group->get_required_field_requests ()){
@@ -558,18 +558,14 @@ void AtmosphereDriver::create_fields()
558
558
// Go through the map entry for each tracer and check that every one
559
559
// has the same request for turbulence advection.
560
560
for (auto fr : tracer_requests) {
561
- bool mismatch_found = false ;
562
-
563
561
const auto reqs = fr.second ;
564
- const bool is_first_turb_advect = ekat::contains (reqs.front ().groups , " turbulence_advected_tracers" );
565
- for (size_t i=1 ; i<reqs.size (); ++i) {
566
- const bool is_turb_advect = ekat::contains (reqs[i].groups , " turbulence_advected_tracers" );
567
- if (is_turb_advect != is_first_turb_advect) {
568
- mismatch_found = true ;
569
- break ;
570
- }
562
+
563
+ std::set<bool > turb_advect_types;
564
+ for (auto req : reqs) {
565
+ turb_advect_types.emplace (ekat::contains (req.groups , " turbulence_advected_tracers" ));
571
566
}
572
- if (mismatch_found) {
567
+
568
+ if (turb_advect_types.size ()!=1 ) {
573
569
std::ostringstream ss;
574
570
ss << " Error! Incompatible tracer request. Turbulence advection requests not consistent among processes.\n "
575
571
" - Tracer name: " + fr.first + " \n "
0 commit comments