https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
45bool
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
63void
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}
const ExecFlagType EXEC_FAILED
Definition Moose.C:50
const ExecFlagType EXEC_FINAL
Definition Moose.C:48
registerMooseObject("MooseApp", SolutionInvalidityOutput)
void ErrorVector unsigned int
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
A MultiMooseEnum object to hold "execute_on" flags.
const ExecFlagType & getCurrentExecuteOnFlag() const
Return/set the current execution flag.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
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.
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.
T & set(const std::string &name, bool quiet_mode=false)
Returns a writable reference to the named parameters.
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:205
void mooseInfo(Args &&... args) const
Definition MooseBase.h:334
Based class for output objects.
Definition Output.h:52
FEProblemBase * _problem_ptr
Pointer the the FEProblemBase object for output object (use this)
Definition Output.h:185
static InputParameters validParams()
Definition Output.C:32
virtual bool shouldOutput()
Handles logic for determining if a step should be output.
Definition Output.C:272
Class to output the solution invalidity history summary to console.
SolutionInvalidityOutput(const InputParameters &parameters)
virtual void output() override
Overload this function with the desired output activities.
virtual bool shouldOutput() override
Handles logic for determining if a step should be output.
SolutionInvalidity & _solution_invalidity
get SolutionInvalidity reference
unsigned int _timestep_interval
define The number of time steps to group together in the table reporting the solution invalidity occu...
static InputParameters validParams()
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
bool hasEverHadSolutionIssue() const
Whether or not any warning or invalid solution has ever been encountered during the simulation.
bool hasInvalidSolution() const
Whether or not any invalid solution was encountered (error or warning).
void printHistory(const ConsoleStream &console, unsigned int &timestep_interval_size) const
Print the time history table of Solution Invalid warnings.