https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SimplePredictor.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 "SimplePredictor.h"
11#include "NonlinearSystem.h"
12
14
17{
20 "Algorithm that will predict the next solution based on previous solutions.");
21 return params;
22}
23
25
26bool
28{
29 bool should_apply = Predictor::shouldApply();
30
31 if (_t_step < 2 || _dt_old <= 0)
32 should_apply = false;
33
34 return should_apply;
35}
36
37void
38SimplePredictor::apply(NumericVector<Number> & sln)
39{
40 _console << " Applying predictor with scale factor = " << _scale << std::endl;
41
42 Real dt_adjusted_scale_factor = _scale * _dt / _dt_old;
43 if (dt_adjusted_scale_factor != 0.0)
44 {
45 sln *= (1.0 + dt_adjusted_scale_factor);
46 sln.add(-dt_adjusted_scale_factor, _solution_older);
47 }
48}
registerMooseObject("MooseApp", SimplePredictor)
const ConsoleStream _console
An instance of helper class to write streams to the Console objects.
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.
Base class for predictors.
Definition Predictor.h:29
virtual bool shouldApply()
Definition Predictor.C:84
Real & _dt_old
Definition Predictor.h:49
Real _scale
Amount by which to scale the predicted value. Must be in [0,1].
Definition Predictor.h:58
static InputParameters validParams()
Definition Predictor.C:21
NumericVector< Number > & _solution_older
Definition Predictor.h:52
Real & _dt
Definition Predictor.h:48
int & _t_step
Definition Predictor.h:47
A SimplePredictor uses an algorithm that will predict the next solution based on previous solutions.
SimplePredictor(const InputParameters &parameters)
virtual void apply(NumericVector< Number > &sln) override
virtual bool shouldApply() override
static InputParameters validParams()