https://mooseframework.inl.gov
SolutionInvalidityOutput.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 // Moose includes
12 #include "MooseApp.h"
15 #include "ConsoleUtils.h"
16 #include "FEProblemBase.h"
17 
19 
22 {
24 
25  params.set<ExecFlagEnum>("execute_on") = {EXEC_FINAL, EXEC_FAILED};
26 
27  params.addParam<unsigned int>("solution_invalidity_timestep_interval",
28  1,
29  "The number of time steps to group together in the table reporting "
30  "the solution invalidity occurrences.");
31 
32  params.addClassDescription("Controls output of the time history of solution invalidity object");
33 
34  return params;
35 }
36 
38  : Output(parameters),
39  _timestep_interval(getParam<unsigned int>("solution_invalidity_timestep_interval")),
40  _solution_invalidity(_app.solutionInvalidity())
41 {
42 }
43 
44 bool
46 {
47  // solver could have failed before any iteration completed, thus before a sync
48  // Note: if this happens in other cases, we should just sync if solutionInvalidity is not synced
52 }
53 
54 void
56 {
57  if (isParamSetByUser("solution_invalidity_timestep_interval"))
58  mooseInfo("Set Outputs/solution_invalidity_history=false to silence the default Solution "
59  "Invalid Warnings History "
60  "table above.");
61  _console << '\n';
63  _console << std::flush;
64 }
const ExecFlagType EXEC_FAILED
Definition: Moose.C:46
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
Class to output the solution invalidity history summary to console.
void mooseInfo(Args &&... args) const
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
registerMooseObject("MooseApp", SolutionInvalidityOutput)
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int _timestep_interval
define The number of time steps to group together in the table reporting the solution invalidity occu...
SolutionInvalidityOutput(const InputParameters &parameters)
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
Definition: Output.C:277
virtual void output() override
Overload this function with the desired output activities.
Based class for output objects.
Definition: Output.h:43
void syncIteration()
Sync iteration counts to main processor.
virtual bool shouldOutput() override
Handles logic for determining if a step should be output.
bool hasInvalidSolution() const
Whether or not any invalid solution was encountered (error or warning).
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition: Output.h:185
static InputParameters validParams()
bool isParamSetByUser(const std::string &nm) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
void printHistory(const ConsoleStream &console, unsigned int &timestep_interval_size) const
Print the time history table of Solution Invalid warnings.
SolutionInvalidity & _solution_invalidity
get SolutionInvalidity reference
const ExecFlagType EXEC_FINAL
Definition: Moose.C:44
static InputParameters validParams()
Definition: Output.C:32
void ErrorVector unsigned int