-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Cleanup of Materials output system #29820
base: next
Are you sure you want to change the base?
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 | ||||
---|---|---|---|---|---|---|
|
@@ -207,7 +207,14 @@ vector or tensor value. | |||||
## Material Property Output | ||||||
|
||||||
Output of `Material` properties is enabled by setting the "outputs" parameter. The following example | ||||||
creates two additional variables called "mat1" and "mat2" that will show up in the output file. | ||||||
creates two additional variables called "mat1" and "mat2" that will show up in the output file. In this | ||||||
example, the `exodus` name is a special keyword used to signal to MOOSE that the material properties | ||||||
should be outputted to the output object created when setting `Outputs/exodus=true`. If multiple output | ||||||
Exodus objects exist in the `[Outputs]` block, one or more names can be provided to the "outputs" | ||||||
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.
Suggested change
|
||||||
parameter. In addition, the reserved output name `all` can be used to output the material property to | ||||||
all Exodus objects in the `[Outputs]` block, while the reserved output name `none` can be used to | ||||||
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. split the text between the example showing an exodus case and 'all'/'none' applying beyond just exodus |
||||||
prevent the material property from being outputted to any Exodus output object. If `all` or `none` | ||||||
is specified in the outputs parameter, no other additional names should be specified. | ||||||
|
||||||
!listing output_block.i block=Materials Outputs | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,8 +61,10 @@ class OutputWarehouse : protected PerfGraphInterface | |
/** | ||
* Returns true if the output object exists | ||
* @param name The name of the output object for which to test for existence within the warehouse | ||
* @param is_exodus Optional parameter to check if the output object associated with name must be | ||
* Exodus type | ||
Comment on lines
+64
to
+65
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. why are we targetting exodus? Let's find a templated way |
||
*/ | ||
bool hasOutput(const std::string & name) const; | ||
bool hasOutput(const std::string & name, const bool is_exodus = false) const; | ||
|
||
/** | ||
* Calls the meshChanged method for every output object | ||
|
@@ -117,10 +119,18 @@ class OutputWarehouse : protected PerfGraphInterface | |
/** | ||
* Test that the output names exist | ||
* @param names A vector of names to check | ||
* This method will produce an error if any of the supplied | ||
* names do not exist in the warehouse. Reserved names are not considered. | ||
* @param is_exodus Optional parameter to check if all output objects associated with names are | ||
* all Exodus type | ||
* This method will produce an error if any of the supplied names do not exist in | ||
* the warehouse. Reserved names are not considered. | ||
*/ | ||
void checkOutputs(const std::set<OutputName> & names); | ||
void checkOutputs(const std::set<OutputName> & names, const bool is_exodus = false); | ||
|
||
/** | ||
* Returns all output names that have an associated Exodus output object | ||
* @return A set of all output names that have Exodus output objects | ||
*/ | ||
const std::set<OutputName> getExodusOutputNames() const; | ||
|
||
/** | ||
* Return an Output object by name | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,8 +103,8 @@ CheckOutputAction::checkMaterialOutput() | |
// Extract the names of the output objects to which the material properties will be exported | ||
std::set<OutputName> outputs = mat->getOutputs(); | ||
|
||
// Check that the outputs exist | ||
_app.getOutputWarehouse().checkOutputs(outputs); | ||
// Check that the outputs exist, and that they are of Exodus type | ||
_app.getOutputWarehouse().checkOutputs(outputs, /* exodus = */ 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. but we could want to be outputting to nemesis / VTK outputs |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,9 +120,18 @@ OutputWarehouse::addOutput(std::shared_ptr<Output> const output) | |
} | ||
|
||
bool | ||
OutputWarehouse::hasOutput(const std::string & name) const | ||
OutputWarehouse::hasOutput(const std::string & name, const bool is_exodus) const | ||
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 d rather you add a templated version over this boolean |
||
{ | ||
return _object_map.find(name) != _object_map.end(); | ||
const auto found_object = _object_map.find(name) != _object_map.end(); | ||
if (!is_exodus || !found_object) | ||
return found_object; | ||
else | ||
{ | ||
// This condition is met if output object was found and is_exodus is true | ||
// Check if output object can be typecast to Exodus | ||
auto * exodus = dynamic_cast<Exodus *>(_object_map.at(name)); | ||
return (exodus != NULL); | ||
} | ||
} | ||
|
||
const std::set<OutputName> & | ||
|
@@ -314,11 +323,37 @@ OutputWarehouse::buildInterfaceHideVariables(const std::string & output_name, | |
} | ||
|
||
void | ||
OutputWarehouse::checkOutputs(const std::set<OutputName> & names) | ||
OutputWarehouse::checkOutputs(const std::set<OutputName> & names, const bool is_exodus) | ||
{ | ||
std::string reserved_name = ""; | ||
for (const auto & name : names) | ||
if (!isReservedName(name) && !hasOutput(name)) | ||
mooseError("The output object '", name, "' is not a defined output object"); | ||
{ | ||
const bool is_reserved_name = isReservedName(name); | ||
if (is_reserved_name) | ||
reserved_name = name; | ||
if (!is_reserved_name && !hasOutput(name, is_exodus)) | ||
mooseError("The output object '", | ||
name, | ||
"' is not a defined ", | ||
(is_exodus ? "Exodus " : ""), | ||
"output object"); | ||
} | ||
if (!reserved_name.empty() && names.size() > 1) | ||
mooseError("When setting output name to reserved name '" + reserved_name + | ||
"', only one entry is allowed in outputs parameter."); | ||
} | ||
|
||
const std::set<OutputName> | ||
OutputWarehouse::getExodusOutputNames() const | ||
{ | ||
std::set<OutputName> exodus_output_names; | ||
for (const auto & pair : _object_map) | ||
{ | ||
auto * exodus = dynamic_cast<Exodus *>(pair.second); | ||
if (exodus != NULL) | ||
exodus_output_names.insert(pair.first); | ||
} | ||
return exodus_output_names; | ||
} | ||
|
||
const std::set<std::string> & | ||
|
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.
is exodus output is the only output handling material properties?
what about Nemesis? VTK ?
The material property output goes to these too
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.
That’s a good point, I’m not sure let me check