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 "VectorVelocityIC.h" 11 : #include "Function.h" 12 : #include "FEProblemBase.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", VectorVelocityIC); 15 : 16 : InputParameters 17 19992 : VectorVelocityIC::validParams() 18 : { 19 19992 : InputParameters params = InitialCondition::validParams(); 20 39984 : params.addRequiredParam<FunctionName>("vel_fn", "Velocity function name"); 21 39984 : params.addRequiredParam<unsigned int>("component", "The vector component of interest"); 22 19992 : params.addClassDescription( 23 : "Computes velocity in the direction of a 1-D element from a vector velocity function"); 24 19992 : return params; 25 0 : } 26 : 27 10926 : VectorVelocityIC::VectorVelocityIC(const InputParameters & parameters) 28 : : InitialCondition(parameters), 29 10926 : _vel_fn(getFunction("vel_fn")), 30 32778 : _component(getParam<unsigned int>("component")) 31 : { 32 10926 : } 33 : 34 : Real 35 70545 : VectorVelocityIC::value(const Point & p) 36 : { 37 70545 : const Elem * el = _fe_problem.mesh().elemPtr(_current_elem->id()); 38 : RealVectorValue dir = el->node_ref(1) - el->node_ref(0); 39 70545 : return _vel_fn.value(_t, p) * dir(_component) / dir.norm(); 40 : }