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 "ShaftConnectedCompressor1PhaseAux.h" 11 : #include "ADShaftConnectedCompressor1PhaseUserObject.h" 12 : 13 : registerMooseObject("ThermalHydraulicsApp", ShaftConnectedCompressor1PhaseAux); 14 : 15 : InputParameters 16 585 : ShaftConnectedCompressor1PhaseAux::validParams() 17 : { 18 585 : InputParameters params = AuxKernel::validParams(); 19 : 20 585 : params.addClassDescription("Computes various quantities for a ShaftConnectedCompressor1Phase."); 21 : 22 : MooseEnum quantity( 23 1170 : "delta_p isentropic_torque dissipation_torque friction_torque moment_of_inertia"); 24 1170 : params.addRequiredParam<MooseEnum>("quantity", quantity, "Which quantity to compute"); 25 1170 : params.addRequiredParam<UserObjectName>("compressor_uo", "Compressor user object name"); 26 : 27 585 : return params; 28 585 : } 29 : 30 310 : ShaftConnectedCompressor1PhaseAux::ShaftConnectedCompressor1PhaseAux( 31 310 : const InputParameters & parameters) 32 : : AuxKernel(parameters), 33 310 : _quantity(this->template getParam<MooseEnum>("quantity").template getEnum<Quantity>()), 34 310 : _compressor_uo( 35 620 : this->template getUserObject<ADShaftConnectedCompressor1PhaseUserObject>("compressor_uo")) 36 : { 37 310 : } 38 : 39 : Real 40 4290 : ShaftConnectedCompressor1PhaseAux::computeValue() 41 : { 42 4290 : switch (_quantity) 43 : { 44 858 : case Quantity::DELTA_P: 45 858 : return MetaPhysicL::raw_value(_compressor_uo.getCompressorDeltaP()); 46 : break; 47 858 : case Quantity::ISENTROPIC_TORQUE: 48 858 : return MetaPhysicL::raw_value(_compressor_uo.getIsentropicTorque()); 49 : break; 50 858 : case Quantity::DISSIPATION_TORQUE: 51 858 : return MetaPhysicL::raw_value(_compressor_uo.getDissipationTorque()); 52 : break; 53 858 : case Quantity::FRICTION_TORQUE: 54 858 : return MetaPhysicL::raw_value(_compressor_uo.getFrictionTorque()); 55 : break; 56 858 : case Quantity::MOMENT_OF_INERTIA: 57 858 : return MetaPhysicL::raw_value(_compressor_uo.getMomentOfInertia()); 58 : break; 59 0 : default: 60 0 : mooseError("Invalid 'quantity' parameter."); 61 : } 62 : }