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