Line data Source code
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 "RelativeSolutionDifferenceNorm.h" 11 : #include "TransientBase.h" 12 : 13 : registerMooseObject("MooseApp", RelativeSolutionDifferenceNorm); 14 : 15 : InputParameters 16 14317 : RelativeSolutionDifferenceNorm::validParams() 17 : { 18 14317 : InputParameters params = GeneralPostprocessor::validParams(); 19 : 20 14317 : params.addClassDescription( 21 : "Computes the relative norm of the solution difference of two consecutive time steps."); 22 : 23 14317 : params.addParam<bool>( 24 : "use_aux", 25 : "If true, use the auxiliary system variables for the norm instead of the solution variables. " 26 : "If false, use the solution system variables only. If not provided, the executioner's value " 27 : "for the 'check_aux' parameter is used."); 28 : 29 14317 : return params; 30 0 : } 31 : 32 26 : RelativeSolutionDifferenceNorm::RelativeSolutionDifferenceNorm(const InputParameters & params) 33 : : GeneralPostprocessor(params), 34 26 : _trex(dynamic_cast<TransientBase *>(_app.getExecutioner())), 35 52 : _use_aux(isParamValid("use_aux") ? getParam<bool>("use_aux") 36 52 : : _trex->getParam<bool>("check_aux")) 37 : { 38 26 : if (!_trex) 39 0 : mooseError("RelativeSolutionDifferenceNorm postprocessor is only for transient calculations"); 40 26 : } 41 : 42 : Real 43 278 : RelativeSolutionDifferenceNorm::getValue() const 44 : { 45 278 : return _trex->relativeSolutionDifferenceNorm(_use_aux); 46 : }