LCOV - code coverage report
Current view: top level - src/components - ElbowPipe1Phase.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 28 32 87.5 %
Date: 2025-07-30 13:02:48 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 "ElbowPipe1Phase.h"
      11             : #include "THMMesh.h"
      12             : 
      13             : registerMooseObject("ThermalHydraulicsApp", ElbowPipe1Phase);
      14             : 
      15             : InputParameters
      16          38 : ElbowPipe1Phase::validParams()
      17             : {
      18          38 :   InputParameters params = FlowChannel1Phase::validParams();
      19          76 :   params.addRequiredParam<Real>("radius", "Radius of the pipe [m]");
      20          76 :   params.addRequiredParam<Real>("start_angle", "Angle at which the pipe starts [degrees]");
      21          76 :   params.addRequiredParam<Real>("end_angle", "Angle at which the pipe ends [degrees]");
      22             : 
      23             :   // Suppress length. Also need to set it to something, because it is required in the parent class
      24          38 :   params.set<std::vector<Real>>("length") = {0.0};
      25          38 :   params.suppressParameter<std::vector<Real>>("length");
      26             : 
      27          38 :   params.addClassDescription("Bent pipe for 1-phase flow");
      28             : 
      29          38 :   return params;
      30           0 : }
      31             : 
      32          19 : ElbowPipe1Phase::ElbowPipe1Phase(const InputParameters & params)
      33             :   : FlowChannel1Phase(params),
      34          19 :     _radius(getParam<Real>("radius")),
      35          38 :     _start_angle(getParam<Real>("start_angle")),
      36          57 :     _end_angle(getParam<Real>("end_angle"))
      37             : {
      38          19 :   if (_start_angle > _end_angle)
      39           0 :     _end_angle += 360.;
      40          19 :   _central_angle = _end_angle - _start_angle;
      41          19 :   if (_central_angle > 360)
      42           0 :     logError("The difference between the angle parameters 'end_angle' and 'start_angle' (",
      43           0 :              _central_angle,
      44             :              ") is greater than 360 degrees");
      45             : 
      46          19 :   _length = 2 * M_PI * _radius * (_central_angle / 360.);
      47          19 :   _lengths[0] = _length;
      48          19 : }
      49             : 
      50             : void
      51          19 : ElbowPipe1Phase::buildMeshNodes()
      52             : {
      53          19 :   Real arc_length = 2 * M_PI * _radius * (_central_angle / 360.);
      54         988 :   for (unsigned int i = 0; i < _node_locations.size(); i++)
      55             :   {
      56             :     // distance from the origin (to account for elements of different sizes)
      57         969 :     Point dist(_node_locations[i], 0., 0.);
      58         969 :     Real x_pos = dist.norm();
      59         969 :     Real alpha = (_start_angle + (_central_angle * x_pos / arc_length)) * M_PI / 180.;
      60         969 :     RealVectorValue p(_radius * cos(alpha), _radius * sin(alpha), 0);
      61         969 :     addNode(p);
      62             :   }
      63          19 : }

Generated by: LCOV version 1.14