-
Notifications
You must be signed in to change notification settings - Fork 55
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
SHOC related diagnostic output #2975
Changes from all commits
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 |
---|---|---|
|
@@ -91,6 +91,25 @@ void SHOCMacrophysics::set_grids(const std::shared_ptr<const GridsManager> grids | |
add_field<Computed>("ustar", scalar2d, m/s, grid_name, ps); | ||
add_field<Computed>("obklen", scalar2d, m, grid_name, ps); | ||
|
||
// Extra SHOC output diagnostics | ||
if (m_params.get<bool>("extra_shoc_diags", false)) { | ||
|
||
// Diagnostic output - mid point grid | ||
add_field<Computed>("brunt", scalar3d_mid, pow(s,-1), grid_name, ps); | ||
add_field<Computed>("shoc_mix", scalar3d_mid, m, grid_name, ps); | ||
add_field<Computed>("isotropy", scalar3d_mid, s, grid_name, ps); | ||
|
||
// Diagnostic output - interface grid | ||
add_field<Computed>("wthl_sec", scalar3d_int, K*(m/s), grid_name, ps); | ||
add_field<Computed>("thl_sec", scalar3d_int, pow(K,2), grid_name, ps); | ||
add_field<Computed>("wqw_sec", scalar3d_int, (kg/kg)*(m/s), grid_name, ps); | ||
add_field<Computed>("qw_sec", scalar3d_int, pow(kg/kg,2), grid_name, ps); | ||
add_field<Computed>("uw_sec", scalar3d_int, pow(m/s,2), grid_name, ps); | ||
add_field<Computed>("vw_sec", scalar3d_int, pow(m/s,2), grid_name, ps); | ||
add_field<Computed>("w3", scalar3d_int, pow(m/s,3), grid_name, ps); | ||
|
||
} // Extra SHOC output diagnostics | ||
|
||
// Tracer group | ||
add_group<Updated>("tracers", grid_name, ps, Bundling::Required); | ||
|
||
|
@@ -495,6 +514,41 @@ void SHOCMacrophysics::run_impl (const double dt) | |
default_policy, | ||
shoc_postprocess); | ||
Kokkos::fence(); | ||
|
||
// Extra SHOC output diagnostics | ||
if (m_params.get<bool>("extra_shoc_diags", false)) { | ||
|
||
const auto& shoc_mix = get_field_out("shoc_mix").get_view<Spack**>(); | ||
Kokkos::deep_copy(shoc_mix,history_output.shoc_mix); | ||
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. This is indeed costly, for no reason. In principle, we would like history_output.shoc_mix to simply use the view stored inside the Field "shoc_mix". We are basically adding 10 3d fields for no real reason... OTOH, this may add more complexity, since we need to be careful during init, depending on the value of
I still think keeping memory under control in this case is doable with not too much effort... 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. The buffer needs a bit of a reworked to allow for it to be dynamically sized based on a param and not be unreadable. @bogensch If you do not want to do that I can take a look. But at the very least we can get rid of the deep copies like Luca said, in initialize_impl:
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. Not too much logic to add. When SHOCMacrophysics::requested_buffer_size_in_bytes and SHOCMacrophysics::init_buffers are called, we can ping m_params, to see if we need the extra mem for those fields or not. 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. You're right, it's not too much logic. But we use a 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. @tcclevenger what's your plan regarding these unnecessary copies? Are you planning to fix them here or in another PR? If the latter, you can go ahead and merge, since the cosp failures are orthogonal. 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'll merge and include this fix in new diag output work. |
||
|
||
const auto& brunt = get_field_out("brunt").get_view<Spack**>(); | ||
Kokkos::deep_copy(brunt,history_output.brunt); | ||
|
||
const auto& w3 = get_field_out("w3").get_view<Spack**>(); | ||
Kokkos::deep_copy(w3,history_output.w3); | ||
|
||
const auto& isotropy = get_field_out("isotropy").get_view<Spack**>(); | ||
Kokkos::deep_copy(isotropy,history_output.isotropy); | ||
|
||
const auto& wthl_sec = get_field_out("wthl_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(wthl_sec,history_output.wthl_sec); | ||
|
||
const auto& wqw_sec = get_field_out("wqw_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(wqw_sec,history_output.wqw_sec); | ||
|
||
const auto& uw_sec = get_field_out("uw_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(uw_sec,history_output.uw_sec); | ||
|
||
const auto& vw_sec = get_field_out("vw_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(vw_sec,history_output.vw_sec); | ||
|
||
const auto& qw_sec = get_field_out("qw_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(qw_sec,history_output.qw_sec); | ||
|
||
const auto& thl_sec = get_field_out("thl_sec").get_view<Spack**>(); | ||
Kokkos::deep_copy(thl_sec,history_output.thl_sec); | ||
|
||
mahf708 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} // Extra SHOC output diagnostics | ||
} | ||
// ========================================================================================= | ||
void SHOCMacrophysics::finalize_impl() | ||
|
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.
While this option makes sense to avoid polluting the FM with stuff we don't need, it has the drawback that users must atmchange this whenever they add one of these fields to their output yaml files.
I suppose this is the best we can do for now. Hopefully this will become obsolete once we rework a bit the IO layer for optional outputs.