Line data Source code
1 : /**********************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* Swift, a Fourier spectral solver for MOOSE */ 4 : /* */ 5 : /* Copyright 2024 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /**********************************************************************/ 8 : 9 : #include "LinearTensorPredictor.h" 10 : 11 : InputParameters 12 0 : LinearTensorPredictor::validParams() 13 : { 14 0 : InputParameters params = TensorPredictor::validParams(); 15 0 : params.addParam<Real>("scale", 1.0, "The scale factor for the predictor (can range from 0 to 1)"); 16 0 : params.set<unsigned int>("history_size") = 2; 17 0 : return params; 18 0 : } 19 : 20 0 : LinearTensorPredictor::LinearTensorPredictor(const InputParameters & parameters) 21 0 : : TensorPredictor(parameters), _scale(getParam<Real>("scale")) 22 : { 23 0 : } 24 : 25 : void 26 0 : LinearTensorPredictor::computeBuffer() 27 : { 28 0 : if (_u_old.size() > 1) 29 : { 30 : // compute difference between the old and older steps 31 0 : const auto diff = _u_old[0] - _u_old[1]; 32 0 : if (_scale == 1.0) 33 0 : _u = _u + diff; 34 : else 35 0 : _u = _u + diff * _scale; 36 : } 37 0 : }