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 "FunctorNeumannBC.h" 11 : 12 : registerMooseObject("MooseApp", FunctorNeumannBC); 13 : 14 : InputParameters 15 14572 : FunctorNeumannBC::validParams() 16 : { 17 14572 : InputParameters params = ADIntegratedBC::validParams(); 18 : 19 14572 : params.addClassDescription("Imposes the integrated boundary condition " 20 : "$\\frac{\\partial u}{\\partial n}=h(t,\\vec{x})$, " 21 : "where $h$ is a functor."); 22 : 23 14572 : params.addRequiredParam<MooseFunctorName>("functor", "The functor to impose"); 24 43716 : params.addParam<MooseFunctorName>( 25 29144 : "coefficient", 1.0, "An optional functor coefficient to multiply the imposed functor"); 26 43716 : params.addParam<bool>("flux_is_inward", 27 29144 : true, 28 : "Set to true if a positive evaluation of the provided functor corresponds " 29 : "to a flux in the inward direction; else the outward direction"); 30 : 31 14572 : return params; 32 0 : } 33 : 34 101 : FunctorNeumannBC::FunctorNeumannBC(const InputParameters & parameters) 35 : : ADIntegratedBC(parameters), 36 101 : _functor(getFunctor<ADReal>("functor")), 37 101 : _coef(getFunctor<ADReal>("coefficient")), 38 202 : _sign(getParam<bool>("flux_is_inward") ? -1.0 : 1.0) 39 : { 40 101 : } 41 : 42 : ADReal 43 58216 : FunctorNeumannBC::computeQpResidual() 44 : { 45 58216 : const Moose::ElemSideQpArg space_arg = {_current_elem, _current_side, _qp, _qrule, _q_point[_qp]}; 46 116432 : return _sign * _coef(space_arg, Moose::currentState()) * 47 174648 : _functor(space_arg, Moose::currentState()) * _test[_i][_qp]; 48 : }