-
Notifications
You must be signed in to change notification settings - Fork 54
MAM4xx: Fixing the ne120 case for the microphysics interface. #3095
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
8590674
f1c9a39
23fd730
e0a1f20
fa86f7a
9f6e83e
c07bc72
e3f6717
2508f47
806a6f1
9788c57
97b2dd7
37ae73a
342958c
3eb6d04
a596e6b
589742d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -448,6 +448,34 @@ inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader( | |||||||||||||||||||||||||||||||||||||||||||||||||
true); | ||||||||||||||||||||||||||||||||||||||||||||||||||
} // create_tracer_data_reader | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader( | ||||||||||||||||||||||||||||||||||||||||||||||||||
const std::shared_ptr<AbstractRemapper> &horiz_remapper, | ||||||||||||||||||||||||||||||||||||||||||||||||||
const std::string &tracer_data_file, | ||||||||||||||||||||||||||||||||||||||||||||||||||
const TracerData &tracer_data, | ||||||||||||||||||||||||||||||||||||||||||||||||||
const std::string &extfrc_map_file | ||||||||||||||||||||||||||||||||||||||||||||||||||
) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
std::vector<Field> io_fields; | ||||||||||||||||||||||||||||||||||||||||||||||||||
for(int i = 0; i < horiz_remapper->get_num_fields(); ++i) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
io_fields.push_back(horiz_remapper->get_src_field(i)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||
const auto io_grid = horiz_remapper->get_src_grid(); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
// NOTE: If we are using a vertical emission NC file with altitude instead of levels, | ||||||||||||||||||||||||||||||||||||||||||||||||||
// we must rename this tag. This is only necessary when a map file is used. | ||||||||||||||||||||||||||||||||||||||||||||||||||
if(tracer_data.file_type == VERT_EMISSION && extfrc_map_file != ""){ | ||||||||||||||||||||||||||||||||||||||||||||||||||
auto horiz_interp_src_grid = | ||||||||||||||||||||||||||||||||||||||||||||||||||
io_grid->clone("tracer_horiz_interp_src_grid", true); | ||||||||||||||||||||||||||||||||||||||||||||||||||
horiz_interp_src_grid->reset_field_tag_name(LEV, "altitude"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
horiz_interp_src_grid->reset_field_tag_name(ILEV, "altitude_int"); | ||||||||||||||||||||||||||||||||||||||||||||||||||
return std::make_shared<AtmosphereInput>(tracer_data_file, horiz_interp_src_grid, io_fields, | ||||||||||||||||||||||||||||||||||||||||||||||||||
true); | ||||||||||||||||||||||||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields, | ||||||||||||||||||||||||||||||||||||||||||||||||||
true); | ||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i still don't think you should overload, see my comments previously --- just add this stuff to the other function with some extra args if you still want to, consider this change
Suggested change
Even better, if you could just add this stuff in the first call as a map inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader(
const std::shared_ptr<AbstractRemapper> &horiz_remapper,
const std::string &tracer_data_file
std::map<FieldTag, std::string>* some_map = nullptr) {
std::vector<Field> io_fields;
for(int i = 0; i < horiz_remapper->get_num_fields(); ++i) {
io_fields.push_back(horiz_remapper->get_src_field(i));
}
auto io_grid = horiz_remapper->get_src_grid();
if (some_map) {
for (const auto& [key, value] : *some_map) {
io_grid->reset_field_tag_name(key, value);
}
}
return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields,
true);
} // create_tracer_data_reader I am assuming this stuff isn't happening on device, and you have to double check the code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. He can't change the remapper src grid, since it's const. He'd have to (shallow) clone it first. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, forgot that ... in the above: - auto io_grid = horiz_remapper->get_src_grid();
+ auto io_grid = horiz_remapper->get_src_grid().clone(...); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I committed a cleaner version of this part of the code. I will clone only the source grid if the file type corresponds to a file with altitude, i.e., the |
||||||||||||||||||||||||||||||||||||||||||||||||||
} // create_tracer_data_reader | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||
inline void update_tracer_data_from_file( | ||||||||||||||||||||||||||||||||||||||||||||||||||
const std::shared_ptr<AtmosphereInput> &scorpio_reader, | ||||||||||||||||||||||||||||||||||||||||||||||||||
const int time_index, // zero-based | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should add a test
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To create a test, I will need to have a map file. Is it possible to include this test in a future PR? Note that the evaluation team is running additional cases that allow us to catch issues.