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};
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 warnings and solution invalidity occurrences.");
31 
32  params.addClassDescription("Controls output of the time history of regular warnings and solution "
33  "invalidity errors and warnings");
34 
35  return params;
36 }
37 
39  : Output(parameters),
40  _timestep_interval(getParam<unsigned int>("solution_invalidity_timestep_interval")),
41  _solution_invalidity(_app.solutionInvalidity())
42 {
43 }
44 
45 bool
47 {
48  // Note: if this happens in other cases, we should just sync if solutionInvalidity is not synced
49  // FAILED: solver could have failed before any iteration completed, thus before a sync
50  // FINAL: we could have hit a solution invalidity on EXEC_FINAL and there are no solver steps
51  // or multiapp fixed point iterations after to cause a sync.
55  // At the known end of a simulation, always output the total summary if anything happened
59  // At other points, we check the current state of the simulation
61 }
62 
63 void
65 {
66  if (isParamSetByUser("solution_invalidity_timestep_interval"))
67  mooseInfo("Set Outputs/solution_invalidity_history=false to silence the default Solution "
68  "Invalid Warnings History table above.");
69  _console << '\n';
71  _console << std::flush;
72 }
void mooseInfo(Args &&... args) const
Definition: MooseBase.h:344
bool hasEverHadSolutionIssue() const
Whether or not any warning or invalid solution has ever been encountered during the simulation...
const ExecFlagType EXEC_FAILED
Definition: Moose.C:48
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
Class to output the solution invalidity history summary to console.
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:268
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 Sum across all processors.
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()
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
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
Definition: MooseBase.h:215
const ExecFlagType EXEC_FINAL
Definition: Moose.C:46
static InputParameters validParams()
Definition: Output.C:32
void ErrorVector unsigned int