Line data Source code
1 : /****************************************************************/ 2 : /* DO NOT MODIFY THIS HEADER */ 3 : /* BlackBear */ 4 : /* */ 5 : /* (c) 2017 Battelle Energy Alliance, LLC */ 6 : /* ALL RIGHTS RESERVED */ 7 : /* */ 8 : /* Prepared by Battelle Energy Alliance, LLC */ 9 : /* Under Contract No. DE-AC07-05ID14517 */ 10 : /* With the U. S. Department of Energy */ 11 : /* */ 12 : /* See COPYRIGHT for full restrictions */ 13 : /****************************************************************/ 14 : 15 : #include "FunctionOffsetDirichletBC.h" 16 : #include "Function.h" 17 : 18 : registerMooseObject("BlackBearApp", FunctionOffsetDirichletBC); 19 : 20 : InputParameters 21 48 : FunctionOffsetDirichletBC::validParams() 22 : { 23 48 : InputParameters params = DirichletBCBase::validParams(); 24 96 : params.addRequiredParam<FunctionName>("function", "The forcing function."); 25 48 : params.addClassDescription( 26 : "Imposes the essential boundary condition $u=g(t,\\vec{x})$, where $g$ " 27 : "is a (possibly) time and space-dependent MOOSE Function, but ofsetting the location where " 28 : "the function is evaluated."); 29 96 : params.addCoupledVar("nx", "x-component of the normal"); 30 96 : params.setDocUnit("nx", "unitless"); 31 96 : params.addCoupledVar("ny", "y-component of the normal"); 32 96 : params.setDocUnit("ny", "unitless"); 33 96 : params.addCoupledVar("nz", "z-component of the normal"); 34 96 : params.setDocUnit("nz", "unitless"); 35 : 36 144 : params.set<std::vector<VariableName>>("nx") = {"nodal_normal_x"}; 37 144 : params.set<std::vector<VariableName>>("ny") = {"nodal_normal_y"}; 38 144 : params.set<std::vector<VariableName>>("nz") = {"nodal_normal_z"}; 39 : 40 96 : params.addParam<Real>( 41 96 : "offset", 0.0, "Offset of the function evaluation location in the direction of nodal normal"); 42 96 : params.setDocUnit("offset", "length"); 43 48 : return params; 44 0 : } 45 : 46 24 : FunctionOffsetDirichletBC::FunctionOffsetDirichletBC(const InputParameters & parameters) 47 : : DirichletBCBase(parameters), 48 24 : _func(getFunction("function")), 49 24 : _nx(coupledValue("nx")), 50 24 : _ny(coupledValue("ny")), 51 24 : _nz(coupledValue("nz")), 52 72 : _offset(getParam<Real>("offset")) 53 : { 54 24 : } 55 : 56 : Real 57 3210 : FunctionOffsetDirichletBC::computeQpValue() 58 : { 59 3210 : _nor = Point(_nx[_qp], _ny[_qp], _nz[_qp]); 60 3210 : return _func.value(_t, (*_current_node + _offset * _nor)); 61 : }