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