diff --git a/external/parthenon b/external/parthenon index 374d08c6..f9e41049 160000 --- a/external/parthenon +++ b/external/parthenon @@ -1 +1 @@ -Subproject commit 374d08c66d1137951816a017c28a201392d46310 +Subproject commit f9e41049178586c26de0c0b069cf7d05075b019d diff --git a/kharma/kharma.hpp b/kharma/kharma.hpp index 323c533e..91c9a99c 100644 --- a/kharma/kharma.hpp +++ b/kharma/kharma.hpp @@ -89,19 +89,23 @@ Packages_t ProcessPackages(std::unique_ptr& pin); * Check whether a given field is anywhere in outputs. * Used to avoid calculating expensive fields (jcon, divB) if they * will not even be written. + * Note this compares the field name as a substring rather than + * an exact match to a vector element, so sub-names like `prims.` + * or `coords.` will match any field which contains them. */ inline bool FieldIsOutput(ParameterInput *pin, std::string name) { InputBlock *pib = pin->pfirst_block; while (pib != nullptr) { - if (pib->block_name.compare(0, 16, "parthenon/output") == 0 && + // For every output block with a 'variables' entry... + if (pib->block_name.find("parthenon/output") != std::string::npos && pin->DoesParameterExist(pib->block_name, "variables")) { std::string allvars = pin->GetString(pib->block_name, "variables"); if (allvars.find(name) != std::string::npos) { return true; } } - pib = pib->pnext; // move to next input block name + pib = pib->pnext; } return false; }