https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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"
15#include "PerfGraphInterface.h"
16#include "TransientInterface.h"
17
21class Convergence : public MooseObject,
22 public SetupInterface,
24 public PerfGraphInterface,
26{
27public:
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
73protected:
77 void verboseOutput(std::ostringstream & oss);
78
81
84
85private:
87 const bool _verbose;
88};
unsigned int PerfID
Definition MooseTypes.h:240
unsigned int THREAD_ID
Definition MooseTypes.h:237
Base class for convergence criteria.
Definition Convergence.h:26
const bool _verbose
Verbose mode enabled.
Definition Convergence.h:87
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
THREAD_ID _tid
Thread ID.
Definition Convergence.h:83
bool verbose() const
Returns whether verbose mode has been enabled.
Definition Convergence.h:71
static InputParameters validParams()
Definition Convergence.C:16
PerfID _perfid_check_convergence
Performance ID for checkConvergence.
Definition Convergence.h:80
void verboseOutput(std::ostringstream &oss)
Outputs the stream to the console if verbose output is enabled.
Definition Convergence.C:51
virtual void initialize()
Method that gets called before each iteration loop.
Definition Convergence.h:53
MooseConvergenceStatus
Status returned by calls to checkConvergence.
Definition Convergence.h:34
virtual MooseConvergenceStatus checkConvergence(unsigned int n_iter)=0
Returns convergence status.
virtual void preExecute()
Method that gets called in each iteration before the solve.
Definition Convergence.h:58
virtual void checkIterationType(IterationType) const
Perform checks related to the iteration type.
Definition Convergence.h:48
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Class for containing MooseEnum item information.
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
Interface for objects interacting with the PerfGraph.
Interface class for classes which interact with Postprocessors.
Interface for objects that needs transient capabilities.