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 "LevelSetForcingFunctionSUPG.h" 11 : #include "Function.h" 12 : 13 : registerMooseObject("LevelSetApp", LevelSetForcingFunctionSUPG); 14 : 15 : InputParameters 16 105 : LevelSetForcingFunctionSUPG::validParams() 17 : { 18 105 : InputParameters params = ADKernelGrad::validParams(); 19 105 : params.addClassDescription("The SUPG stablization term for a forcing function."); 20 210 : params.addParam<FunctionName>("function", "1", "A function that describes the body force"); 21 210 : params.addRequiredCoupledVar("velocity", "Velocity vector variable."); 22 105 : return params; 23 0 : } 24 : 25 60 : LevelSetForcingFunctionSUPG::LevelSetForcingFunctionSUPG(const InputParameters & parameters) 26 : : ADKernelGrad(parameters), 27 60 : _function(getFunction("function")), 28 120 : _velocity(adCoupledVectorValue("velocity")) 29 : { 30 60 : } 31 : 32 : ADRealVectorValue 33 6607232 : LevelSetForcingFunctionSUPG::precomputeQpResidual() 34 : { 35 : ADReal tau = 36 13214464 : _current_elem->hmin() / 37 13214464 : (2 * (_velocity[_qp] + RealVectorValue(libMesh::TOLERANCE * libMesh::TOLERANCE)).norm()); 38 19821696 : return -tau * _velocity[_qp] * _function.value(_t, _q_point[_qp]); 39 : }