www.mooseframework.org
LevelSetOlssonTerminator.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 
9 #include "NonlinearSystem.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<GeneralUserObject>();
16  params.addClassDescription("Tool for terminating the reinitialization of the level set equation "
17  "based on the criteria defined by Olsson et. al. (2007).");
18  params.addRequiredParam<Real>(
19  "tol", "The limit at which the reinitialization problem is considered converged.");
20  params.addParam<int>("min_steps", 3, "The minimum number of time steps to consider.");
21  return params;
22 }
23 
25  : GeneralUserObject(params),
26  _solution_diff(_fe_problem.getNonlinearSystem().addVector("solution_diff", false, PARALLEL)),
27  _tol(getParam<Real>("tol")),
28  _min_t_steps(getParam<int>("min_steps"))
29 {
30 }
31 
32 void
34 {
35  _solution_diff = *_fe_problem.getNonlinearSystem().currentSolution();
36  _solution_diff -= _fe_problem.getNonlinearSystem().solutionOld();
37  Real delta = _solution_diff.l2_norm() / _dt;
38  _console << "Computed convergence criteria: " << delta << std::endl;
39 
40  if (_fe_problem.timeStep() < _min_t_steps)
41  return;
42  else if (delta < _tol)
43  _fe_problem.terminateSolve();
44 }
const Real & _tol
The steady-state convergence tolerance.
NumericVector< Number > & _solution_diff
The difference of current and old solutions.
InputParameters validParams< LevelSetOlssonTerminator >()
virtual void execute() override
const int & _min_t_steps
The required minimum number of timesteps.
LevelSetOlssonTerminator(const InputParameters &parameters)