https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ElbowPipe1Phase.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 "ElbowPipe1Phase.h"
11#include "THMMesh.h"
12
13registerMooseObject("ThermalHydraulicsApp", ElbowPipe1Phase);
14
17{
19 params.addRequiredParam<Real>("radius", "Radius of the pipe [m]");
20 params.addRequiredParam<Real>("start_angle", "Angle at which the pipe starts [degrees]");
21 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 params.set<std::vector<Real>>("length") = {0.0};
25 params.suppressParameter<std::vector<Real>>("length");
26
27 params.addClassDescription("Bent pipe for 1-phase flow");
28
29 return params;
30}
31
33 : FlowChannel1Phase(params),
34 _radius(getParam<Real>("radius")),
35 _start_angle(getParam<Real>("start_angle")),
36 _end_angle(getParam<Real>("end_angle"))
37{
39 _end_angle += 360.;
41 if (_central_angle > 360)
42 logError("The difference between the angle parameters 'end_angle' and 'start_angle' (",
44 ") is greater than 360 degrees");
45
46 _length = 2 * M_PI * _radius * (_central_angle / 360.);
47 _lengths[0] = _length;
48}
49
50void
52{
53 Real arc_length = 2 * M_PI * _radius * (_central_angle / 360.);
54 for (unsigned int i = 0; i < _node_locations.size(); i++)
55 {
56 // distance from the origin (to account for elements of different sizes)
57 Point dist(_node_locations[i], 0., 0.);
58 Real x_pos = dist.norm();
59 Real alpha = (_start_angle + (_central_angle * x_pos / arc_length)) * M_PI / 180.;
60 RealVectorValue p(_radius * cos(alpha), _radius * sin(alpha), 0);
61 addNode(p);
62 }
63}
registerMooseObject("ThermalHydraulicsApp", ElbowPipe1Phase)
const Real p
void logError(Args &&... args) const
Logs an error.
Definition Component.h:226
Node * addNode(const Point &pt)
Definition Component.C:203
std::vector< Real > _lengths
Length of each axial section.
Bent pipe for 1-phase flow.
static InputParameters validParams()
virtual void buildMeshNodes() override
Real _central_angle
central angle
ElbowPipe1Phase(const InputParameters &params)
Real _start_angle
Start angle [degrees].
Real _radius
Radius of the pipe [m].
Real _end_angle
End angle [degrees].
Single-component, single-phase flow channel.
static InputParameters validParams()
std::vector< Real > _node_locations
Node locations along the main axis.
void suppressParameter(const std::string &name)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)