https://mooseframework.inl.gov
Classes | Public Types | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
SolutionInvalidity Class Reference

The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidity. More...

#include <SolutionInvalidity.h>

Inheritance diagram for SolutionInvalidity:
[legend]

Classes

struct  InvalidCounts
 Struct used in _counts for storing warning and invalid-solution occurrences. More...
 
struct  TimestepCounts
 Struct used in InvalidCounts for storing the time history of invalid occurrences. More...
 

Public Types

using SolutionInvalidityRegistry = moose::internal::SolutionInvalidityRegistry
 

Public Member Functions

 SolutionInvalidity (MooseApp &app)
 Create a new SolutionInvalidity. More...
 
void flagInvalidSolutionInternal (const InvalidSolutionID _invalid_solution_id)
 Increments solution invalid occurrences for each solution id. More...
 
bool hasInvalidSolutionWarning () const
 Whether or not an invalid solution was encountered that was a warning. More...
 
bool hasInvalidSolutionError () const
 Whether or not an invalid solution was encountered that was an error. More...
 
bool hasInvalidSolution () const
 Whether or not any invalid solution was encountered (error or warning). More...
 
bool hasEverHadSolutionIssue () const
 Whether or not any warning or invalid solution has ever been encountered during the simulation. More...
 
void resetTimeStepOccurences ()
 Reset the number of solution invalid occurrences back to zero for the current time step. More...
 
void resetIterationOccurences ()
 Reset the number of solution invalid occurrences back to zero. More...
 
void accumulateIterationIntoTimeStepOccurences ()
 Pass the number of solution invalid occurrences from current iteration to cumulative counters. More...
 
void accumulateTimeStepIntoTotalOccurences (const unsigned int timestep_index)
 Pass the number of solution invalid occurrences from current timestep to cumulative timestep counter (e.g. the total) More...
 
const std::vector< InvalidCounts > & counts () const
 Access the private solution invalidity counts. More...
 
void print (const ConsoleStream &console) const
 Print the summary table of Solution Invalid warnings. More...
 
void printHistory (const ConsoleStream &console, unsigned int &timestep_interval_size) const
 Print the time history table of Solution Invalid warnings. More...
 
void printDebug (InvalidSolutionID _invalid_solution_id) const
 Immediately print the section and message for debug purpose. More...
 
void syncIteration ()
 Sync iteration counts to main processor Sum across all processors. More...
 
bool hasSynced () const
 Whether the solution invalidity has synchronized iteration counts across MPI processes. More...
 
const Parallel::Communicatorcomm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Protected Attributes

const ConsoleStream _console
 An instance of helper class to write streams to the Console objects. More...
 
const Parallel::Communicator_communicator
 

Private Types

typedef VariadicTable< std::string, unsigned long int, unsigned long int, unsigned long int, std::string > FullTable
 
typedef VariadicTable< std::string, std::string, unsigned long int, unsigned long intTimeTable
 

Private Member Functions

FullTable summaryTable () const
 Build a VariadicTable for solution invalidity. More...
 
TimeTable transientTable (unsigned int &time_interval) const
 Build a VariadicTable for solution invalidity history. More...
 

Private Attributes

std::mutex _invalid_mutex
 Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes. More...
 
SolutionInvalidityRegistry_solution_invalidity_registry
 Create a registry to keep track of the names and occurrences of the solution invalidity. More...
 
std::vector< InvalidCounts_counts
 Store the solution invalidity counts. More...
 
bool _has_synced
 Whether or not we've synced (can check counts/existance of warnings or errors) More...
 
bool _has_solution_warning
 Whether or not we have a warning (only after a sync) More...
 
bool _has_solution_error
 Whether or not we have an invalid solution (only after a sync) More...
 
bool _has_recorded_issue
 Whether or not we have ever had any warning or solution issue during the simulation. More...
 

Friends

void dataStore (std::ostream &, SolutionInvalidity &, void *)
 
void dataLoad (std::istream &, SolutionInvalidity &, void *)
 

Detailed Description

The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidity.

Definition at line 37 of file SolutionInvalidity.h.

Member Typedef Documentation

◆ FullTable

typedef VariadicTable<std::string, unsigned long int, unsigned long int, unsigned long int, std::string> SolutionInvalidity::FullTable
private

Definition at line 154 of file SolutionInvalidity.h.

◆ SolutionInvalidityRegistry

Definition at line 40 of file SolutionInvalidity.h.

◆ TimeTable

typedef VariadicTable<std::string, std::string, unsigned long int, unsigned long int> SolutionInvalidity::TimeTable
private

Definition at line 159 of file SolutionInvalidity.h.

Constructor & Destructor Documentation

◆ SolutionInvalidity()

SolutionInvalidity::SolutionInvalidity ( MooseApp app)

Create a new SolutionInvalidity.

Definition at line 27 of file SolutionInvalidity.C.

29  ParallelObject(app.comm()),
31  _has_synced(true),
32  _has_solution_warning(false),
33  _has_solution_error(false),
34  _has_recorded_issue(false)
35 {
36 }
ParallelObject(const Parallel::Communicator &comm_in)
bool _has_recorded_issue
Whether or not we have ever had any warning or solution issue during the simulation.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Parallel::Communicator & comm() const
bool _has_solution_warning
Whether or not we have a warning (only after a sync)
ConsoleStreamInterface(MooseApp &app)
A class for providing a helper stream object for writting message to all the Output objects...
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.

Member Function Documentation

◆ accumulateIterationIntoTimeStepOccurences()

void SolutionInvalidity::accumulateIterationIntoTimeStepOccurences ( )

Pass the number of solution invalid occurrences from current iteration to cumulative counters.

Definition at line 94 of file SolutionInvalidity.C.

Referenced by NonlinearSystemBase::computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), NonlinearSystemBase::computeResidualInternal(), FEProblemSolve::initialSetup(), and FixedPointSolve::solveStep().

95 {
96  for (auto & entry : _counts)
97  entry.current_timestep_counts += entry.current_counts;
98 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ accumulateTimeStepIntoTotalOccurences()

void SolutionInvalidity::accumulateTimeStepIntoTotalOccurences ( const unsigned int  timestep_index)

Pass the number of solution invalid occurrences from current timestep to cumulative timestep counter (e.g. the total)

Definition at line 101 of file SolutionInvalidity.C.

Referenced by FEProblemSolve::initialSetup(), and FixedPointSolve::solveStep().

102 {
103  for (auto & entry : _counts)
104  if (entry.current_timestep_counts)
105  {
106  if (entry.timestep_counts.empty() ||
107  entry.timestep_counts.back().timestep_index != timestep_index)
108  entry.timestep_counts.emplace_back(timestep_index);
109  entry.timestep_counts.back().counts = entry.current_timestep_counts;
110  entry.total_counts += entry.current_timestep_counts;
111  }
112 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ counts()

const std::vector<InvalidCounts>& SolutionInvalidity::counts ( ) const
inline

Access the private solution invalidity counts.

Definition at line 113 of file SolutionInvalidity.h.

Referenced by syncIteration(), and to_json().

113 { return _counts; }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ flagInvalidSolutionInternal()

void SolutionInvalidity::flagInvalidSolutionInternal ( const InvalidSolutionID  _invalid_solution_id)

Increments solution invalid occurrences for each solution id.

Definition at line 39 of file SolutionInvalidity.C.

40 {
41  std::lock_guard<std::mutex> lock_id(_invalid_mutex);
42  if (_counts.size() <= _invalid_solution_id)
43  _counts.resize(_invalid_solution_id + 1);
44 
45  ++_counts[_invalid_solution_id].current_counts;
46 }
std::mutex _invalid_mutex
Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes.
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ hasEverHadSolutionIssue()

bool SolutionInvalidity::hasEverHadSolutionIssue ( ) const

Whether or not any warning or invalid solution has ever been encountered during the simulation.

This must be called after a sync.

Definition at line 69 of file SolutionInvalidity.C.

Referenced by SolutionInvalidityOutput::shouldOutput().

70 {
71  mooseAssert(_has_synced, "Has not synced");
72  return _has_recorded_issue;
73 }
bool _has_recorded_issue
Whether or not we have ever had any warning or solution issue during the simulation.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)

◆ hasInvalidSolution()

bool SolutionInvalidity::hasInvalidSolution ( ) const

Whether or not any invalid solution was encountered (error or warning).

This must be called after a sync.

Definition at line 63 of file SolutionInvalidity.C.

Referenced by SolutionInvalidityOutput::shouldOutput().

64 {
66 }
bool hasInvalidSolutionError() const
Whether or not an invalid solution was encountered that was an error.
bool hasInvalidSolutionWarning() const
Whether or not an invalid solution was encountered that was a warning.

◆ hasInvalidSolutionError()

bool SolutionInvalidity::hasInvalidSolutionError ( ) const

Whether or not an invalid solution was encountered that was an error.

This must be called after a sync.

Definition at line 56 of file SolutionInvalidity.C.

Referenced by FEProblemBase::acceptInvalidSolution(), hasInvalidSolution(), and printHistory().

57 {
58  mooseAssert(_has_synced, "Has not synced");
59  return _has_solution_error;
60 }
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)

◆ hasInvalidSolutionWarning()

bool SolutionInvalidity::hasInvalidSolutionWarning ( ) const

Whether or not an invalid solution was encountered that was a warning.

This must be called after a sync.

Definition at line 49 of file SolutionInvalidity.C.

Referenced by hasInvalidSolution().

50 {
51  mooseAssert(_has_synced, "Has not synced");
52  return _has_solution_warning;
53 }
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
bool _has_solution_warning
Whether or not we have a warning (only after a sync)

◆ hasSynced()

bool SolutionInvalidity::hasSynced ( ) const
inline

Whether the solution invalidity has synchronized iteration counts across MPI processes.

Definition at line 139 of file SolutionInvalidity.h.

Referenced by NonlinearSystem::converged().

139 { return _has_synced; }
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)

◆ print()

void SolutionInvalidity::print ( const ConsoleStream console) const

Print the summary table of Solution Invalid warnings.

Parameters
consoleThe output stream to output to

Definition at line 115 of file SolutionInvalidity.C.

116 {
117  console << "\nSolution Invalid Warnings:\n";
118  summaryTable().print(console);
119 }
void print(StreamType &stream)
Pretty print the table of data.
Definition: VariadicTable.h:98
FullTable summaryTable() const
Build a VariadicTable for solution invalidity.

◆ printDebug()

void SolutionInvalidity::printDebug ( InvalidSolutionID  _invalid_solution_id) const

Immediately print the section and message for debug purpose.

Definition at line 208 of file SolutionInvalidity.C.

Referenced by SolutionInvalidInterface::flagInvalidSolutionInternal().

209 {
210  const auto & info = _solution_invalidity_registry.item(_invalid_solution_id);
211  _console << info.object_type << ": " << info.message << "\n" << std::flush;
212 }
MPI_Info info
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.

◆ printHistory()

void SolutionInvalidity::printHistory ( const ConsoleStream console,
unsigned int timestep_interval_size 
) const

Print the time history table of Solution Invalid warnings.

Parameters
consoleThe output stream to output to

Definition at line 122 of file SolutionInvalidity.C.

Referenced by SolutionInvalidityOutput::output().

124 {
126  console << "\nSolution Invalid History:\n";
127  else
128  console << "\nWarnings History:\n";
129  transientTable(timestep_interval_size).print(console);
130 }
bool hasInvalidSolutionError() const
Whether or not an invalid solution was encountered that was an error.
void print(StreamType &stream)
Pretty print the table of data.
Definition: VariadicTable.h:98
TimeTable transientTable(unsigned int &time_interval) const
Build a VariadicTable for solution invalidity history.

◆ resetIterationOccurences()

void SolutionInvalidity::resetIterationOccurences ( )

Reset the number of solution invalid occurrences back to zero.

Definition at line 76 of file SolutionInvalidity.C.

Referenced by FEProblemBase::computeJacobianSys(), FEProblemBase::computeResidualSys(), and FixedPointSolve::solveStep().

77 {
78  // Zero current counts
79  for (auto & entry : _counts)
80  entry.current_counts = 0;
81 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.

◆ resetTimeStepOccurences()

void SolutionInvalidity::resetTimeStepOccurences ( )

Reset the number of solution invalid occurrences back to zero for the current time step.

Definition at line 84 of file SolutionInvalidity.C.

Referenced by FixedPointSolve::solveStep().

85 {
86  // Reset that we have synced because we're on a new iteration
87  _has_synced = false;
88 
89  for (auto & entry : _counts)
90  entry.current_timestep_counts = 0;
91 }
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)

◆ summaryTable()

SolutionInvalidity::FullTable SolutionInvalidity::summaryTable ( ) const
private

Build a VariadicTable for solution invalidity.

Definition at line 215 of file SolutionInvalidity.C.

Referenced by print().

216 {
217  mooseAssert(_has_synced, "Has not synced");
218 
219  FullTable vtable({"Object", "Converged", "Timestep", "Total", "Message"}, 4);
220 
221  vtable.setColumnFormat({
222  VariadicTableColumnFormat::AUTO, // Object Type
223  VariadicTableColumnFormat::AUTO, // Converged Iteration Warnings
224  VariadicTableColumnFormat::AUTO, // Latest Time Step Warnings
225  VariadicTableColumnFormat::AUTO, // Total Simulation Warnings
227  });
228 
229  vtable.setColumnPrecision({
230  1, // Object Name
231  0, // Converged Iteration Warnings
232  0, // Latest Time Step Warnings
233  0, // Total Simulation Warnings
234  1, // Message
235  });
236 
237  if (processor_id() == 0)
238  {
239  for (const auto id : index_range(_counts))
240  {
241  const auto & entry = _counts[id];
242  if (entry.current_counts)
243  {
244  const auto & info = _solution_invalidity_registry.item(id);
245  vtable.addRow(info.object_type, // Object Type
246  entry.current_counts, // Converged Iteration Warnings
247  entry.current_timestep_counts, // Latest Time Step Warnings
248  entry.total_counts, // Total Iteration Warnings
249  info.message // Message
250  );
251  }
252  }
253  }
254 
255  return vtable;
256 }
VariadicTable< std::string, unsigned long int, unsigned long int, unsigned long int, std::string > FullTable
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ syncIteration()

void SolutionInvalidity::syncIteration ( )

Sync iteration counts to main processor Sum across all processors.

Definition at line 133 of file SolutionInvalidity.C.

Referenced by SolverSystem::checkInvalidSolution(), NonlinearSystemBase::computeJacobianInternal(), LinearSystem::computeLinearSystemInternal(), NonlinearSystemBase::computeResidualInternal(), dataStore(), FEProblemSolve::initialSetup(), SolutionInvalidityOutput::shouldOutput(), and FixedPointSolve::solveStep().

134 {
135  std::map<processor_id_type, std::vector<std::tuple<std::string, std::string, int, unsigned int>>>
136  data_to_send;
137 
138  // Reset this as we need to see if we have new counts
139  _has_solution_warning = false;
140  _has_solution_error = false;
141 
142  for (const auto id : index_range(_counts))
143  {
144  auto & entry = _counts[id];
145  if (entry.current_counts)
146  {
147  const auto & info = _solution_invalidity_registry.item(id);
148  data_to_send[0].emplace_back(
149  info.object_type, info.message, info.warning, entry.current_counts);
150  entry.current_counts = 0;
151  }
152  }
153 
154  const auto receive_data = [this](const processor_id_type libmesh_dbg_var(pid), const auto & data)
155  {
156  mooseAssert(processor_id() == 0, "Should only receive on processor 0");
157 
158  for (const auto & [object_type, message, warning_int, counts] : data)
159  {
160  mooseAssert(counts, "Should not send data without counts");
161 
162  // We transfer this as an integer (which is guaranteed by the standard to cast to a bool)
163  // because TIMPI doesn't currently support transferring bools
164  const bool warning = warning_int;
165 
166  InvalidSolutionID main_id = 0;
167  const moose::internal::SolutionInvalidityName name(object_type, message);
169  {
170  main_id = _solution_invalidity_registry.id(name);
171  mooseAssert(_solution_invalidity_registry.item(main_id).warning == warning,
172  "Inconsistent registration of invalidity warning and error");
173  }
174  else
175  {
176  mooseAssert(pid != 0, "Should only hit on other processors");
178  object_type, message, warning);
179  }
180  if (_counts.size() <= main_id)
181  _counts.resize(main_id + 1);
182 
183  _counts[main_id].current_counts += counts;
184 
185  if (warning)
186  _has_solution_warning = true;
187  else
188  _has_solution_error = true;
189  }
190  };
191 
192  // Communicate the counts
193  TIMPI::push_parallel_vector_data(comm(), data_to_send, receive_data);
194 
195  // Set the state across all processors
198 
199  // Keep track of any occurence
201  _has_recorded_issue = true;
202 
203  // We've now synced
204  _has_synced = true;
205 }
std::string name(const ElemQuality q)
bool _has_recorded_issue
Whether or not we have ever had any warning or solution issue during the simulation.
const std::vector< InvalidCounts > & counts() const
Access the private solution invalidity counts.
MPI_Info info
unsigned int InvalidSolutionID
Definition: MooseTypes.h:241
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Parallel::Communicator & comm() const
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
void push_parallel_vector_data(const Communicator &comm, MapToVectors &&data, const ActionFunctor &act_on_data)
uint8_t processor_id_type
std::size_t id(const Key &key) const
bool _has_solution_warning
Whether or not we have a warning (only after a sync)
const Item & item(const std::size_t id) const
Helper class that stores the name associated with an invalid solution.
bool _has_solution_error
Whether or not we have an invalid solution (only after a sync)
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
void max(const T &r, T &o, Request &req) const
bool keyExists(const Key &key) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

◆ transientTable()

SolutionInvalidity::TimeTable SolutionInvalidity::transientTable ( unsigned int time_interval) const
private

Build a VariadicTable for solution invalidity history.

Definition at line 259 of file SolutionInvalidity.C.

Referenced by printHistory().

260 {
261  mooseAssert(_has_synced, "Has not synced");
262 
263  TimeTable vtable({"Object", "Step", "Interval Count", "Total Count"}, 4);
264 
265  vtable.setColumnFormat({
266  VariadicTableColumnFormat::AUTO, // Object information
267  VariadicTableColumnFormat::AUTO, // Simulation Time Step
268  VariadicTableColumnFormat::AUTO, // Latest Time Step Warnings
269  VariadicTableColumnFormat::AUTO, // Total Iteration Warnings
270  });
271 
272  vtable.setColumnPrecision({
273  1, // Object information
274  1, // Simulation Time Step
275  0, // Latest Time Step Warnings
276  0, // Total Iteration Warnings
277  });
278 
279  if (processor_id() == 0)
280  {
281  for (const auto id : index_range(_counts))
282  {
283  const auto & entry = _counts[id];
284  const auto & info = _solution_invalidity_registry.item(id);
285  std::vector<unsigned int> interval_counts;
286  std::vector<unsigned int> total_counts;
287 
288  if (!entry.timestep_counts.empty())
289  {
290  // Allow warnings from the setup step
291  for (unsigned int timestep = 0; timestep <= entry.timestep_counts.back().timestep_index;
292  timestep += step_interval)
293  {
294 
295  auto start_it = timestep;
296  auto end_it = (timestep + step_interval < entry.timestep_counts.back().timestep_index)
297  ? start_it + step_interval
298  : entry.timestep_counts.back().timestep_index;
299 
300  int interval_sum = 0;
301  for (auto ts_count : entry.timestep_counts)
302  {
303  // Allow warnings from the setup step
304  if (ts_count.timestep_index >= start_it &&
305  (ts_count.timestep_index < end_it || start_it == end_it))
306  interval_sum += ts_count.counts;
307  }
308 
309  interval_counts.push_back(interval_sum);
310  }
311  }
312 
313  unsigned int interval_sum = 0;
314  for (unsigned int interval_index : index_range(interval_counts))
315  {
316  std::string interval_index_str =
317  (step_interval > 1) ? std::to_string(interval_index) + "-" +
318  std::to_string(interval_index + step_interval - 1)
319  : std::to_string(interval_index);
320 
321  interval_sum += interval_counts[interval_index];
322  vtable.addRow(info.object_type + " : " + info.message, // Object information
323  interval_index_str, // Interval Index
324  interval_counts[interval_index], // Interval Counts
325  interval_sum // Total Iteration Warnings
326 
327  );
328  }
329  }
330  }
331  return vtable;
332 }
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
bool _has_synced
Whether or not we&#39;ve synced (can check counts/existance of warnings or errors)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
const Item & item(const std::size_t id) const
VariadicTable< std::string, std::string, unsigned long int, unsigned long int > TimeTable
processor_id_type processor_id() const
auto index_range(const T &sizable)

Friends And Related Function Documentation

◆ dataLoad

void dataLoad ( std::istream &  stream,
SolutionInvalidity solution_invalidity,
void context 
)
friend

Definition at line 384 of file SolutionInvalidity.C.

385 {
386  if (solution_invalidity.processor_id() != 0)
387  return;
388 
389  std::size_t num_counts;
390  // load data block size
391  dataLoad(stream, num_counts, context);
392 
393  std::string object_type, message;
394  bool warning;
396 
397  // loop over and load stored data
398  for (size_t i = 0; i < num_counts; i++)
399  {
400  dataLoad(stream, object_type, context);
401  dataLoad(stream, message, context);
402  dataLoad(stream, warning, context);
403 
404  const moose::internal::SolutionInvalidityName name(object_type, message);
405  if (solution_invalidity._solution_invalidity_registry.keyExists(name))
406  id = solution_invalidity._solution_invalidity_registry.id(name);
407  else
409  object_type, message, warning);
410 
411  if (solution_invalidity._counts.size() <= id)
412  solution_invalidity._counts.resize(id + 1);
413 
414  auto & entry = solution_invalidity._counts[id];
415  dataLoad(stream, entry.current_counts, context);
416  dataLoad(stream, entry.current_timestep_counts, context);
417  dataLoad(stream, entry.timestep_counts, context);
418  dataLoad(stream, entry.total_counts, context);
419  }
420 }
std::string name(const ElemQuality q)
unsigned int InvalidSolutionID
Definition: MooseTypes.h:241
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
friend void dataLoad(std::istream &, SolutionInvalidity &, void *)
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
InvalidSolutionID registerInvalidity(const std::string &object_type, const std::string &message, const bool warning)
Call to register an invalid calculation.
std::size_t id(const Key &key) const
Helper class that stores the name associated with an invalid solution.
SolutionInvalidityRegistry & getSolutionInvalidityRegistry()
Get the global SolutionInvalidityRegistry singleton.
bool keyExists(const Key &key) const
processor_id_type processor_id() const

◆ dataStore

void dataStore ( std::ostream &  stream,
SolutionInvalidity solution_invalidity,
void context 
)
friend

Definition at line 355 of file SolutionInvalidity.C.

356 {
357  solution_invalidity.syncIteration();
358 
359  if (solution_invalidity.processor_id() != 0)
360  return;
361 
362  // Build data structure for store
363  std::size_t size = solution_invalidity._counts.size();
364  dataStore(stream, size, context);
365 
366  for (const auto id : index_range(solution_invalidity._counts))
367  {
368  auto & entry = solution_invalidity._counts[id];
369  const auto & info = solution_invalidity._solution_invalidity_registry.item(id);
370  std::string type = info.object_type;
371  std::string message = info.message;
372  bool warning = info.warning;
373  dataStore(stream, type, context);
374  dataStore(stream, message, context);
375  dataStore(stream, warning, context);
376  dataStore(stream, entry.current_counts, context);
377  dataStore(stream, entry.current_timestep_counts, context);
378  dataStore(stream, entry.timestep_counts, context);
379  dataStore(stream, entry.total_counts, context);
380  }
381 }
MPI_Info info
std::vector< InvalidCounts > _counts
Store the solution invalidity counts.
SolutionInvalidityRegistry & _solution_invalidity_registry
Create a registry to keep track of the names and occurrences of the solution invalidity.
friend void dataStore(std::ostream &, SolutionInvalidity &, void *)
void syncIteration()
Sync iteration counts to main processor Sum across all processors.
const Item & item(const std::size_t id) const
processor_id_type processor_id() const
auto index_range(const T &sizable)

Member Data Documentation

◆ _console

const ConsoleStream ConsoleStreamInterface::_console
inherited

An instance of helper class to write streams to the Console objects.

Definition at line 31 of file ConsoleStreamInterface.h.

Referenced by IterationAdaptiveDT::acceptStep(), MeshOnlyAction::act(), SetupDebugAction::act(), MaterialOutputAction::act(), Adaptivity::adaptMesh(), FEProblemBase::adaptMesh(), PerfGraph::addToExecutionList(), SimplePredictor::apply(), SystemBase::applyScalingFactors(), MultiApp::backup(), FEProblemBase::backupMultiApps(), CoarsenedPiecewiseLinear::buildCoarsenedGrid(), DefaultSteadyStateConvergence::checkConvergence(), MeshDiagnosticsGenerator::checkElementOverlap(), MeshDiagnosticsGenerator::checkElementTypes(), MeshDiagnosticsGenerator::checkElementVolumes(), FEProblemBase::checkExceptionAndStopSolve(), SolverSystem::checkInvalidSolution(), MeshDiagnosticsGenerator::checkLocalJacobians(), MeshDiagnosticsGenerator::checkNonConformalMesh(), MeshDiagnosticsGenerator::checkNonConformalMeshFromAdaptivity(), MeshDiagnosticsGenerator::checkNonMatchingEdges(), MeshDiagnosticsGenerator::checkNonPlanarSides(), MeshDiagnosticsGenerator::checkPolygons(), FEProblemBase::checkProblemIntegrity(), ReferenceResidualConvergence::checkRelativeConvergence(), MeshDiagnosticsGenerator::checkSidesetsOrientation(), MeshDiagnosticsGenerator::checkWatertightNodesets(), MeshDiagnosticsGenerator::checkWatertightSidesets(), IterationAdaptiveDT::computeAdaptiveDT(), TransientBase::computeConstrainedDT(), DefaultMultiAppFixedPointConvergence::computeCustomConvergencePostprocessor(), NonlinearSystemBase::computeDamping(), FixedPointIterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeDT(), IterationAdaptiveDT::computeFailedDT(), IterationAdaptiveDT::computeInitialDT(), IterationAdaptiveDT::computeInterpolationDT(), LinearSystem::computeLinearSystemTags(), FEProblemBase::computeLinearSystemTags(), NonlinearSystemBase::computeScaling(), Problem::console(), IterationAdaptiveDT::constrainStep(), TimeStepper::constrainStep(), MultiApp::createApp(), FEProblemBase::execMultiApps(), FEProblemBase::execMultiAppTransfers(), MFEMSteady::execute(), MessageFromInput::execute(), SteadyBase::execute(), Eigenvalue::execute(), ActionWarehouse::executeActionsWithAction(), ActionWarehouse::executeAllActions(), MeshGeneratorSystem::executeMeshGenerators(), ElementQualityChecker::finalize(), SidesetAroundSubdomainUpdater::finalize(), FEProblemBase::finishMultiAppStep(), MeshRepairGenerator::fixOverlappingNodes(), SurfaceSubdomainsDelaunayRemesher::General2DDelaunay(), OrientSurfaceMeshGenerator::generate(), CoarsenBlockGenerator::generate(), PolyLineMeshFollowingNodeSetGenerator::generate(), MeshGenerator::generateInternal(), VariableCondensationPreconditioner::getDofToCondense(), InversePowerMethod::init(), NonlinearEigen::init(), FEProblemBase::initialAdaptMesh(), DefaultMultiAppFixedPointConvergence::initialize(), SubProblem::initialSetup(), EigenExecutionerBase::inversePowerIteration(), FEProblemBase::joinAndFinalize(), TransientBase::keepGoing(), IterationAdaptiveDT::limitDTByFunction(), IterationAdaptiveDT::limitDTToPostprocessorValue(), FEProblemBase::logAdd(), EigenExecutionerBase::makeBXConsistent(), Console::meshChanged(), SurfaceDelaunayGeneratorBase::meshNormalDeviation2D(), MooseBase::mooseDeprecated(), MooseBase::mooseDeprecatedNoTrace(), MooseBase::mooseInfo(), MooseBase::mooseWarning(), MooseBase::mooseWarningNonPrefixed(), ReferenceResidualConvergence::nonlinearConvergenceSetup(), ReporterDebugOutput::output(), PerfGraphOutput::output(), SolutionInvalidityOutput::output(), MaterialPropertyDebugOutput::output(), DOFMapOutput::output(), VariableResidualNormsDebugOutput::output(), Console::output(), ControlOutput::outputActiveObjects(), ControlOutput::outputChangedControls(), ControlOutput::outputControls(), Console::outputInput(), WebServerControl::outputMessage(), Console::outputPostprocessors(), PseudoTimestep::outputPseudoTimestep(), Console::outputReporters(), DefaultMultiAppFixedPointConvergence::outputResidualNorm(), Console::outputScalarVariables(), Console::outputSystemInformation(), FEProblemBase::possiblyRebuildGeomSearchPatches(), EigenExecutionerBase::postExecute(), AB2PredictorCorrector::postSolve(), ActionWarehouse::printActionDependencySets(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), printDebug(), EigenExecutionerBase::printEigenvalue(), SecantSolve::printFixedPointConvergenceHistory(), SteffensenSolve::printFixedPointConvergenceHistory(), PicardSolve::printFixedPointConvergenceHistory(), FixedPointSolve::printFixedPointConvergenceReason(), PerfGraphLivePrint::printLiveMessage(), MaterialPropertyDebugOutput::printMaterialMap(), PerfGraphLivePrint::printStats(), NEML2Action::printSummary(), AutomaticMortarGeneration::projectPrimaryNodesSinglePair(), AutomaticMortarGeneration::projectSecondaryNodesSinglePair(), CoarsenBlockGenerator::recursiveCoarsen(), SolutionTimeAdaptiveDT::rejectStep(), MultiApp::restore(), FEProblemBase::restoreMultiApps(), FEProblemBase::restoreSolutions(), NonlinearSystemBase::setInitialSolution(), MooseApp::setupOptions(), Checkpoint::shouldOutput(), SubProblem::showFunctorRequestors(), SubProblem::showFunctors(), FullSolveMultiApp::showStatusMessage(), EigenProblem::solve(), FEProblemSolve::solve(), FixedPointSolve::solve(), NonlinearSystem::solve(), LinearSystem::solve(), LStableDirk2::solve(), LStableDirk3::solve(), ImplicitMidpoint::solve(), ExplicitTVDRK2::solve(), AStableDirk4::solve(), LStableDirk4::solve(), ExplicitRK2::solve(), TransientMultiApp::solveStep(), FixedPointSolve::solveStep(), MeshRepairGenerator::splitNonConvexPolygons(), PerfGraphLivePrint::start(), WebServerControl::startServer(), AB2PredictorCorrector::step(), NonlinearEigen::takeStep(), MFEMTransient::takeStep(), TransientBase::takeStep(), TerminateChainControl::terminate(), SubProblem::timestepSetup(), FEProblemBase::updateMeshXFEM(), Convergence::verboseOutput(), Console::writeTimestepInformation(), Console::writeVariableNorms(), and FEProblemBase::~FEProblemBase().

◆ _counts

std::vector<InvalidCounts> SolutionInvalidity::_counts
private

◆ _has_recorded_issue

bool SolutionInvalidity::_has_recorded_issue
private

Whether or not we have ever had any warning or solution issue during the simulation.

Definition at line 177 of file SolutionInvalidity.h.

Referenced by hasEverHadSolutionIssue(), and syncIteration().

◆ _has_solution_error

bool SolutionInvalidity::_has_solution_error
private

Whether or not we have an invalid solution (only after a sync)

Definition at line 175 of file SolutionInvalidity.h.

Referenced by hasInvalidSolutionError(), and syncIteration().

◆ _has_solution_warning

bool SolutionInvalidity::_has_solution_warning
private

Whether or not we have a warning (only after a sync)

Definition at line 173 of file SolutionInvalidity.h.

Referenced by hasInvalidSolutionWarning(), and syncIteration().

◆ _has_synced

bool SolutionInvalidity::_has_synced
private

Whether or not we've synced (can check counts/existance of warnings or errors)

Definition at line 171 of file SolutionInvalidity.h.

Referenced by hasEverHadSolutionIssue(), hasInvalidSolutionError(), hasInvalidSolutionWarning(), hasSynced(), resetTimeStepOccurences(), summaryTable(), syncIteration(), and transientTable().

◆ _invalid_mutex

std::mutex SolutionInvalidity::_invalid_mutex
mutableprivate

Mutex for locking access to the invalid counts TODO: These can be changed to shared_mutexes.

Definition at line 147 of file SolutionInvalidity.h.

Referenced by flagInvalidSolutionInternal().

◆ _solution_invalidity_registry

SolutionInvalidityRegistry& SolutionInvalidity::_solution_invalidity_registry
private

Create a registry to keep track of the names and occurrences of the solution invalidity.

Definition at line 165 of file SolutionInvalidity.h.

Referenced by dataLoad(), dataStore(), printDebug(), summaryTable(), syncIteration(), and transientTable().


The documentation for this class was generated from the following files: