https://mooseframework.inl.gov
ComponentsConvergence.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 #include "ComponentsConvergence.h"
11 #include "THMProblem.h"
12 #include "Component.h"
13 
14 registerMooseObject("ThermalHydraulicsApp", ComponentsConvergence);
15 
18 {
20 
21  params.addClassDescription("Assesses convergence of all Component objects in a simulation.");
22 
23  return params;
24 }
25 
27  : IterationCountConvergence(parameters),
28  _thm_problem(
29  dynamic_cast<THMProblem *>(getCheckedPointerParam<FEProblemBase *>("_fe_problem_base")))
30 {
31  if (!_thm_problem)
32  mooseError("ComponentsConvergence only works with THMProblem.");
33 }
34 
35 void
37 {
39 
40  for (const auto & comp : _thm_problem->getComponents())
41  {
42  const auto nl_conv = comp->getNonlinearConvergence();
43  if (nl_conv)
44  _convergence_objects.push_back(nl_conv);
45  }
46 }
47 
50 {
51  bool all_converged = true;
52  for (auto & conv : _convergence_objects)
53  {
54  const auto status = conv->checkConvergence(iter);
58  all_converged = false;
59  else
60  {
61  // checking in case additional status added in future
63  "Status not implemented");
64  }
65  }
66 
67  if (all_converged)
69  else
71 }
Specialization of FEProblem to run with component subsystem.
Definition: THMProblem.h:18
virtual void initialSetup() override
ComponentsConvergence(const InputParameters &parameters)
const std::vector< std::shared_ptr< Component > > & getComponents() const
Return list of components available in the simulation.
Definition: Simulation.h:117
std::vector< Convergence * > _convergence_objects
Convergence objects for all Components that provide one.
registerMooseObject("ThermalHydraulicsApp", ComponentsConvergence)
MPI_Status status
static InputParameters validParams()
const THMProblem *const _thm_problem
THM problem.
Assesses convergence of all Component objects in a simulation.
virtual MooseConvergenceStatus checkConvergenceInner(unsigned int iter) override
static InputParameters validParams()
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
virtual void initialSetup() override