LCOV - code coverage report
Current view: top level - src/ics - VectorVelocityIC.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 13 14 92.9 %
Date: 2026-05-29 20:41:18 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14