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