https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Transient.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 "Transient.h"
11
12// MOOSE includes
13#include "FixedPointSolve.h"
14#include "AuxiliarySystem.h"
15#include "SolverSystem.h"
16
18
21{
23 params.addClassDescription("Executioner for time varying simulations.");
24
26
27 return params;
28}
29
31 : TransientBase(parameters), _feproblem_solve(*this)
32{
34}
35
36void
43
44Real
46{
47 if (check_aux)
49 else
50 {
51 // Default criterion for now until we add a "steady-state-convergence-object" option
52 Real residual = 0;
53 for (const auto sys : _feproblem_solve.systemsToSolve())
54 residual +=
55 std::pow(sys->solution().l2_norm_diff(sys->solutionOld()) / sys->solution().l2_norm(), 2);
56 return std::sqrt(residual);
57 }
58}
59
60std::set<TimeIntegrator *>
62{
63 // We use a set because time integrators were added to every system, and we want a unique
64 std::set<TimeIntegrator *> tis;
65 // Get all time integrators from the systems in the FEProblemSolve
66 for (const auto sys : _feproblem_solve.systemsToSolve())
67 for (const auto & ti : sys->getTimeIntegrators())
68 tis.insert(ti.get());
69 return tis;
70}
registerMooseObject("MooseApp", Transient)
std::unique_ptr< FixedPointSolve > _fixed_point_solve
virtual void initialSetup() override
Method that should be executed once, before any solve calls.
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump.
const std::vector< SolverSystem * > & systemsToSolve() const
Returns a reference to the vector of solver systems that this object is supposed to solve.
NumericVector< Number > & solutionOld()
Definition SystemBase.h:204
NumericVector< Number > & solution()
Definition SystemBase.h:203
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
static InputParameters validParams()
virtual void init() override
Initialize the executioner.
AuxiliarySystem & _aux
Reference to auxiliary system base for faster access.
Transient executioners usually loop through a number of timesteps... calling solve() for each timeste...
Definition Transient.h:21
static InputParameters validParams()
Definition Transient.C:20
virtual void init() override
Initialize the executioner.
Definition Transient.C:37
virtual std::set< TimeIntegrator * > getTimeIntegrators() const override
Get the time integrators (time integration scheme) used Note that because some systems might be stead...
Definition Transient.C:61
virtual Real relativeSolutionDifferenceNorm(bool check_aux) const override
The relative L2 norm of the difference between solution and old solution vector.
Definition Transient.C:45
Transient(const InputParameters &parameters)
Definition Transient.C:30
FEProblemSolve _feproblem_solve
inner-most solve object to perform Newton solve with PETSc on every time step
Definition Transient.h:38
Real l2_norm_diff(const NumericVector< T > &other_vec) const
virtual Real l2_norm() const=0
MooseUnits pow(const MooseUnits &, int)
Definition Units.C:537