https://mooseframework.inl.gov
VectorVelocityIC.C
Go to the documentation of this file.
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 
18 {
20  params.addRequiredParam<FunctionName>("vel_fn", "Velocity function name");
21  params.addRequiredParam<unsigned int>("component", "The vector component of interest");
22  params.addClassDescription(
23  "Computes velocity in the direction of a 1-D element from a vector velocity function");
24  return params;
25 }
26 
28  : InitialCondition(parameters),
29  _vel_fn(getFunction("vel_fn")),
30  _component(getParam<unsigned int>("component"))
31 {
32 }
33 
34 Real
35 VectorVelocityIC::value(const Point & p)
36 {
37  const Elem * el = _fe_problem.mesh().elemPtr(_current_elem->id());
38  RealVectorValue dir = el->node_ref(1) - el->node_ref(0);
39  return _vel_fn.value(_t, p) * dir(_component) / dir.norm();
40 }
auto norm() const -> decltype(std::norm(Real()))
virtual Real value(const Point &p) override
virtual Elem * elemPtr(const dof_id_type i)
const unsigned int _component
Vector component to use.
const Function & _vel_fn
Velocity function.
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
registerMooseObject("ThermalHydraulicsApp", VectorVelocityIC)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual MooseMesh & mesh() override
void addClassDescription(const std::string &doc_string)
const Elem *const & _current_elem
FEProblemBase & _fe_problem
virtual Real value(Real t, const Point &p) const
Computes velocity in the direction of a 1-D element from a vector velocity function.
void ErrorVector unsigned int
VectorVelocityIC(const InputParameters &parameters)