https://mooseframework.inl.gov
Convergence.h
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 #pragma once
11 
12 #include "MooseObject.h"
13 #include "SetupInterface.h"
14 #include "PostprocessorInterface.h"
15 #include "PerfGraphInterface.h"
16 #include "TransientInterface.h"
17 
21 class Convergence : public MooseObject,
22  public SetupInterface,
24  public PerfGraphInterface,
25  public TransientInterface
26 {
27 public:
29 
34  {
35  ITERATING = 0,
36  CONVERGED = 1,
37  DIVERGED = -1
38  };
39 
42 
44 
45  virtual void initialSetup() override {}
46 
48  virtual void checkIterationType(IterationType /*it_type*/) const {}
49 
53  virtual void initialize() {}
54 
58  virtual void preExecute() {}
59 
68  virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter) = 0;
69 
71  bool verbose() const { return _verbose; }
72 
73 protected:
77  void verboseOutput(std::ostringstream & oss);
78 
81 
84 
85 private:
87  const bool _verbose;
88 };
THREAD_ID _tid
Thread ID.
Definition: Convergence.h:83
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
Definition: Convergence.h:45
virtual void initialize()
Method that gets called before each iteration loop.
Definition: Convergence.h:53
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
void verboseOutput(std::ostringstream &oss)
Outputs the stream to the console if verbose output is enabled.
Definition: Convergence.C:51
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
unsigned int PerfID
Definition: MooseTypes.h:240
Interface for objects that needs transient capabilities.
Base class for convergence criteria.
Definition: Convergence.h:21
Every object that can be built by the factory should be derived from this class.
Definition: MooseObject.h:28
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter)=0
Returns convergence status.
const bool _verbose
Verbose mode enabled.
Definition: Convergence.h:87
virtual void checkIterationType(IterationType) const
Perform checks related to the iteration type.
Definition: Convergence.h:48
Interface for objects interacting with the PerfGraph.
MooseConvergenceStatus
Status returned by calls to checkConvergence.
Definition: Convergence.h:33
PerfID _perfid_check_convergence
Performance ID for checkConvergence.
Definition: Convergence.h:80
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
static InputParameters validParams()
Definition: Convergence.C:16
virtual void preExecute()
Method that gets called in each iteration before the solve.
Definition: Convergence.h:58
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:237
bool verbose() const
Returns whether verbose mode has been enabled.
Definition: Convergence.h:71
Convergence(const InputParameters &parameters)
Definition: Convergence.C:38