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 "BodyForceLM.h" 11 : 12 : #include "Function.h" 13 : 14 : registerMooseObject("ScalarTransportApp", BodyForceLM); 15 : 16 : InputParameters 17 79 : BodyForceLM::validParams() 18 : { 19 79 : auto params = LMKernel::validParams(); 20 158 : params.addParam<Real>("value", 1.0, "Coefficient to multiply by the body force term"); 21 158 : params.addParam<FunctionName>("function", "1", "A function that describes the body force"); 22 237 : params.addParam<PostprocessorName>( 23 158 : "postprocessor", 1, "A postprocessor whose value is multiplied by the body force"); 24 158 : params.declareControllable("value"); 25 79 : params.addClassDescription( 26 : "Imposes a body force onto a Lagrange multiplier constrained primal equation"); 27 79 : return params; 28 0 : } 29 : 30 44 : BodyForceLM::BodyForceLM(const InputParameters & parameters) 31 : : LMKernel(parameters), 32 44 : _scale(getParam<Real>("value")), 33 44 : _function(getFunction("function")), 34 88 : _postprocessor(getPostprocessorValue("postprocessor")) 35 : { 36 44 : } 37 : 38 : ADReal 39 401700 : BodyForceLM::precomputeQpResidual() 40 : { 41 401700 : return -_scale * _postprocessor * _function.value(_t, _q_point[_qp]); 42 : }