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 
41 
42  virtual void initialSetup() override {}
43 
47  virtual void initialize() {}
48 
52  virtual void preExecute() {}
53 
59  virtual MooseConvergenceStatus checkConvergence(unsigned int iter) = 0;
60 
62  bool verbose() const { return _verbose; }
63 
64 protected:
68  void verboseOutput(std::ostringstream & oss);
69 
72 
75 
76 private:
78  const bool _verbose;
79 };
THREAD_ID _tid
Thread ID.
Definition: Convergence.h:74
virtual void initialSetup() override
Gets called at the beginning of the simulation before this object is asked to do its job...
Definition: Convergence.h:42
virtual void initialize()
Method that gets called before each iteration loop.
Definition: Convergence.h:47
virtual MooseConvergenceStatus checkConvergence(unsigned int iter)=0
Returns convergence status.
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:212
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
const bool _verbose
Verbose mode enabled.
Definition: Convergence.h:78
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:71
static InputParameters validParams()
Definition: Convergence.C:16
const InputParameters & parameters() const
Get the parameters of the object.
virtual void preExecute()
Method that gets called in each iteration before the solve.
Definition: Convergence.h:52
Interface class for classes which interact with Postprocessors.
unsigned int THREAD_ID
Definition: MooseTypes.h:209
bool verbose() const
Returns whether verbose mode has been enabled.
Definition: Convergence.h:62
Convergence(const InputParameters &parameters)
Definition: Convergence.C:38