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.addCoupledVar("ny", "y-component of the normal"); 31 96 : params.addCoupledVar("nz", "z-component of the normal"); 32 : 33 144 : params.set<std::vector<VariableName>>("nx") = {"nodal_normal_x"}; 34 144 : params.set<std::vector<VariableName>>("ny") = {"nodal_normal_y"}; 35 144 : params.set<std::vector<VariableName>>("nz") = {"nodal_normal_z"}; 36 : 37 96 : params.addParam<Real>( 38 96 : "offset", 0.0, "Offset of the function evaluation location in the direction of nodal normal"); 39 48 : return params; 40 0 : } 41 : 42 24 : FunctionOffsetDirichletBC::FunctionOffsetDirichletBC(const InputParameters & parameters) 43 : : DirichletBCBase(parameters), 44 24 : _func(getFunction("function")), 45 24 : _nx(coupledValue("nx")), 46 24 : _ny(coupledValue("ny")), 47 24 : _nz(coupledValue("nz")), 48 72 : _offset(getParam<Real>("offset")) 49 : { 50 24 : } 51 : 52 : Real 53 3210 : FunctionOffsetDirichletBC::computeQpValue() 54 : { 55 3210 : _nor = Point(_nx[_qp], _ny[_qp], _nz[_qp]); 56 3210 : return _func.value(_t, (*_current_node + _offset * _nor)); 57 : }