https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14registerMooseObject("ThermalHydraulicsApp", VectorVelocityIC);
15
18{
20 params.addRequiredParam<FunctionName>("vel_fn", "Velocity function name");
21 params.addRequiredParam<unsigned int>("component", "The vector component of interest");
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
34Real
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}
const Real p
registerMooseObject("ThermalHydraulicsApp", VectorVelocityIC)
void ErrorVector unsigned int
virtual MooseMesh & mesh() override
virtual Real value(Real t, const Point &p) const
FEProblemBase & _fe_problem
const Elem *const & _current_elem
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
virtual Elem * elemPtr(const dof_id_type i)
Computes velocity in the direction of a 1-D element from a vector velocity function.
virtual Real value(const Point &p) override
static InputParameters validParams()
const unsigned int _component
Vector component to use.
VectorVelocityIC(const InputParameters &parameters)
const Function & _vel_fn
Velocity function.