Skip to content

Commit 3620a08

Browse files
committed
denote fields from IC properly and change blue color code
fixed minor bug--still an issue with 2 fields in p3 for pg2 cases
1 parent 53e9a97 commit 3620a08

File tree

3 files changed

+213
-53
lines changed

3 files changed

+213
-53
lines changed

components/eamxx/src/control/atmosphere_driver.cpp

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,10 @@ void AtmosphereDriver::create_atm_processes()
245245
if (verb_lvl > 0) {
246246
// create an initial DAG with only atm_process nodes
247247
AtmProcDAG dag;
248-
249248
// First, add all atm processes
250249
dag.init_atm_proc_nodes(*m_atm_process_group);
251-
252250
// Write a dot file for visualization
253-
dag.write_dag("dag_createAtmProcs-nodesOnly.dot", std::max(verb_lvl, 0));
251+
dag.write_dag("createProc_dag.dot", std::max(verb_lvl, 0));
254252
}
255253
}
256254

@@ -711,7 +709,7 @@ void AtmosphereDriver::create_fields()
711709
dag.create_dag(*m_atm_process_group);
712710

713711
// Write a dot file for visualization
714-
dag.write_dag("dag_createFields.dot",std::max(verb_lvl,0));
712+
dag.write_dag("createField_dag.dot", std::max(verb_lvl,0));
715713
}
716714

717715
m_ad_status |= s_fields_created;
@@ -902,15 +900,12 @@ initialize_fields ()
902900
// generate the full DAG, resolving any spurious unmet dependencies that
903901
// may be provided by initial conditions
904902
AtmProcDAG dag;
905-
906903
// First, add all atm processes
907904
dag.create_dag(*m_atm_process_group);
908-
909905
// process the initial conditions to maybe fulfill unmet dependencies
910-
dag.process_initial_conditions(m_fields_inited);
911-
906+
dag.process_IC_alt(m_fields_inited);
912907
// Write a dot file for visualization
913-
dag.write_dag("dag_init_fields-after_IC.dot",std::max(verb_lvl,0));
908+
dag.write_dag("initField_dag.dot", std::max(verb_lvl,0));
914909
}
915910

916911
// Initialize fields
@@ -1134,6 +1129,7 @@ void AtmosphereDriver::set_initial_conditions ()
11341129
grid_name == "Point Grid") {
11351130
this_grid_topo_file_fnames.push_back("PHIS_d");
11361131
this_grid_topo_eamxx_fnames.push_back(fname);
1132+
// FIXME:
11371133
m_fields_inited[grid_name].push_back(fname);
11381134
} else {
11391135
EKAT_ERROR_MSG ("Error! Requesting phis on an unknown grid: " + grid_name + ".\n");
@@ -1146,7 +1142,7 @@ void AtmosphereDriver::set_initial_conditions ()
11461142
" topo file only has sgh30 for Physics PG2.\n");
11471143
topography_file_fields_names[grid_name].push_back("SGH30");
11481144
topography_eamxx_fields_names[grid_name].push_back(fname);
1149-
m_fields_inited[grid_name].push_back(fname);
1145+
m_fields_inited[grid_name].push_back(fname);
11501146
}
11511147
} else if (not (fvphyshack and grid_name == "Physics PG2")) {
11521148
// The IC file is written for the GLL grid, so we only load
@@ -1158,7 +1154,7 @@ void AtmosphereDriver::set_initial_conditions ()
11581154
// If this field is the parent of other subfields, we only read from file the subfields.
11591155
if (not ekat::contains(this_grid_ic_fnames,fname)) {
11601156
this_grid_ic_fnames.push_back(fname);
1161-
m_fields_inited[grid_name].push_back(fname);
1157+
m_fields_inited[grid_name].push_back(fname);
11621158
}
11631159
} else if (fvphyshack and grid_name == "Physics GLL") {
11641160
// [CGLL ICs in pg2] I tried doing something like this in
@@ -1175,7 +1171,7 @@ void AtmosphereDriver::set_initial_conditions ()
11751171
} else {
11761172
this_grid_ic_fnames.push_back(fname);
11771173
}
1178-
m_fields_inited[grid_name].push_back(fname);
1174+
m_fields_inited[grid_name].push_back(fname);
11791175
}
11801176
}
11811177
}
@@ -1239,17 +1235,21 @@ void AtmosphereDriver::set_initial_conditions ()
12391235
// lat/lon data in topo file is defined in terms of PG2 grid,
12401236
// so if we have a topo field on GLL grid, we need to setup
12411237
// io info using the IC file (which is always GLL).
1242-
for (const auto& it : m_field_mgrs) {
1243-
const auto& grid_name = it.first;
1238+
for (const auto &it : m_field_mgrs) {
1239+
const auto &grid_name = it.first;
12441240
if (ic_fields_names[grid_name].size() > 0 or
1245-
topography_eamxx_fields_names[grid_name].size() > 0) {
1246-
const auto& file_name = grid_name == "Physics GLL"
1247-
?
1248-
ic_pl.get<std::string>("Filename")
1249-
:
1250-
ic_pl.get<std::string>("topography_filename");
1241+
topography_eamxx_fields_names[grid_name].size() > 0) {
1242+
const auto &file_name =
1243+
grid_name == "Physics GLL"
1244+
? ic_pl.get<std::string>("Filename")
1245+
: ic_pl.get<std::string>("topography_filename");
12511246
m_iop->setup_io_info(file_name, it.second->get_grid());
12521247
}
1248+
// // f_iop is std::map<std::string, Field>
1249+
// auto f_iop = m_iop->get_iop_field_map();
1250+
// for (const auto &f : f_iop) {
1251+
// m_fields_inited[grid_name].push_back(f.first);
1252+
// }
12531253
}
12541254
}
12551255

@@ -1269,6 +1269,7 @@ void AtmosphereDriver::set_initial_conditions ()
12691269
ic_fields_names[grid_name],
12701270
m_current_ts,
12711271
it.second);
1272+
// m_fields_inited[grid_name].push_back(ic_fields_names[grid_name]);
12721273
}
12731274
}
12741275
}
@@ -1293,6 +1294,8 @@ void AtmosphereDriver::set_initial_conditions ()
12931294
// Get the two fields, and copy src to tgt
12941295
auto f_tgt = fm->get_field(tgt_fname);
12951296
auto f_src = fm->get_field(src_fname);
1297+
// FIXME:
1298+
// m_fields_inited[gname].push_back(tgt_fname);
12961299
f_tgt.deep_copy(f_src);
12971300

12981301
// Set the initial time stamp
@@ -1348,6 +1351,10 @@ void AtmosphereDriver::set_initial_conditions ()
13481351
read_fields_from_file (topography_file_fields_names[grid_name],
13491352
topography_eamxx_fields_names[grid_name],
13501353
io_grid,file_name,m_current_ts);
1354+
// auto &f_grid = topography_eamxx_fields_names[grid_name];
1355+
// for (const auto &f : f_grid) {
1356+
// m_fields_inited[grid_name].push_back(f);
1357+
// }
13511358
} else {
13521359
// For IOP enabled, we load from file and copy data from the closest
13531360
// lat/lon column to every other column
@@ -1356,6 +1363,7 @@ void AtmosphereDriver::set_initial_conditions ()
13561363
topography_eamxx_fields_names[grid_name],
13571364
m_current_ts,
13581365
it.second);
1366+
// m_fields_inited[grid_name].push_back(topography_eamxx_fields_names[grid_name]);
13591367
}
13601368
}
13611369
// Store in provenance list, for later usage in output file metadata
@@ -1526,6 +1534,8 @@ read_fields_from_file (const std::vector<std::string>& field_names,
15261534
std::vector<Field> fields;
15271535
for (const auto& fn : field_names) {
15281536
fields.push_back(field_mgr->get_field(fn));
1537+
// // FIXME:
1538+
// m_fields_inited[grid->name()].push_back(fn);
15291539
}
15301540

15311541
AtmosphereInput ic_reader(file_name,grid,fields);
@@ -1643,6 +1653,21 @@ void AtmosphereDriver::initialize_atm_procs ()
16431653
m_atm_logger->info("[EAMxx] initialize_atm_procs ... done!");
16441654

16451655
report_res_dep_memory_footprint ();
1656+
1657+
auto& driver_options_pl = m_atm_params.sublist("driver_options");
1658+
const int verb_lvl = driver_options_pl.get<int>("atmosphere_dag_verbosity_level",-1);
1659+
if (verb_lvl>0) {
1660+
// now that we've got fields, generate a DAG with fields and dependencies
1661+
// NOTE: at this point, fields provided by initial conditions may (will)
1662+
// appear as unment dependencies
1663+
AtmProcDAG dag;
1664+
// First, add all atm processes
1665+
dag.create_dag(*m_atm_process_group);
1666+
// process the initial conditions to maybe fulfill unmet dependencies
1667+
dag.process_IC_alt(m_fields_inited);
1668+
// Write a dot file for visualization
1669+
dag.write_dag("initProc_dag.dot", std::max(verb_lvl,0));
1670+
}
16461671
}
16471672

16481673
void AtmosphereDriver::

0 commit comments

Comments
 (0)