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 18 : ElbowPipe1Phase::validParams() 17 : { 18 18 : InputParameters params = FlowChannel1Phase::validParams(); 19 36 : params.addRequiredParam<Real>("radius", "Radius of the pipe [m]"); 20 36 : params.addRequiredParam<Real>("start_angle", "Angle at which the pipe starts [degrees]"); 21 36 : 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 18 : params.set<std::vector<Real>>("length") = {0.0}; 25 18 : params.suppressParameter<std::vector<Real>>("length"); 26 : 27 18 : params.addClassDescription("Bent pipe for 1-phase flow"); 28 : 29 18 : return params; 30 0 : } 31 : 32 9 : ElbowPipe1Phase::ElbowPipe1Phase(const InputParameters & params) 33 : : FlowChannel1Phase(params), 34 9 : _radius(getParam<Real>("radius")), 35 18 : _start_angle(getParam<Real>("start_angle")), 36 27 : _end_angle(getParam<Real>("end_angle")) 37 : { 38 9 : if (_start_angle > _end_angle) 39 0 : _end_angle += 360.; 40 9 : _central_angle = _end_angle - _start_angle; 41 9 : 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 9 : _length = 2 * M_PI * _radius * (_central_angle / 360.); 47 9 : _lengths[0] = _length; 48 9 : } 49 : 50 : void 51 9 : ElbowPipe1Phase::buildMeshNodes() 52 : { 53 9 : Real arc_length = 2 * M_PI * _radius * (_central_angle / 360.); 54 468 : for (unsigned int i = 0; i < _node_locations.size(); i++) 55 : { 56 : // distance from the origin (to account for elements of different sizes) 57 459 : Point dist(_node_locations[i], 0., 0.); 58 459 : Real x_pos = dist.norm(); 59 459 : Real alpha = (_start_angle + (_central_angle * x_pos / arc_length)) * M_PI / 180.; 60 459 : RealVectorValue p(_radius * cos(alpha), _radius * sin(alpha), 0); 61 459 : addNode(p); 62 : } 63 9 : }