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 "ADPump1PhaseUserObject.h" 11 : #include "SinglePhaseFluidProperties.h" 12 : #include "THMIndicesVACE.h" 13 : #include "VolumeJunction1Phase.h" 14 : #include "NumericalFlux3EqnBase.h" 15 : #include "Numerics.h" 16 : 17 : registerMooseObject("ThermalHydraulicsApp", ADPump1PhaseUserObject); 18 : 19 : InputParameters 20 359 : ADPump1PhaseUserObject::validParams() 21 : { 22 359 : InputParameters params = ADVolumeJunction1PhaseUserObject::validParams(); 23 : 24 718 : params.addRequiredParam<Real>("head", "Pump head, [m]"); 25 718 : params.addRequiredParam<Real>("gravity_magnitude", "Gravity constant, [m/s^2]"); 26 : 27 718 : params.addClassDescription("Computes and caches flux and residual vectors for a 1-phase pump"); 28 : 29 718 : params.declareControllable("head"); 30 : 31 359 : return params; 32 0 : } 33 : 34 195 : ADPump1PhaseUserObject::ADPump1PhaseUserObject(const InputParameters & params) 35 : : ADVolumeJunction1PhaseUserObject(params), 36 195 : _head(getParam<Real>("head")), 37 585 : _g(getParam<Real>("gravity_magnitude")) 38 : { 39 195 : } 40 : 41 : void 42 34148 : ADPump1PhaseUserObject::computeFluxesAndResiduals(const unsigned int & c) 43 : { 44 34148 : ADVolumeJunction1PhaseUserObject::computeFluxesAndResiduals(c); 45 : 46 : const auto & rhoV = _cached_junction_var_values[VolumeJunction1Phase::RHOV_INDEX]; 47 : const auto & rhouV = _cached_junction_var_values[VolumeJunction1Phase::RHOUV_INDEX]; 48 : const auto & rhovV = _cached_junction_var_values[VolumeJunction1Phase::RHOVV_INDEX]; 49 : const auto & rhowV = _cached_junction_var_values[VolumeJunction1Phase::RHOWV_INDEX]; 50 : 51 34148 : const ADRealVectorValue di = _dir[0]; 52 34148 : const ADReal rho = rhoV / _volume; 53 34148 : const ADRealVectorValue uvec(rhouV / rhoV, rhovV / rhoV, rhowV / rhoV); 54 : 55 : // compute momentum and energy source terms 56 34148 : const ADRealVectorValue S_momentum = 0.5 * rho * _g * _head * _A_ref * di; 57 34148 : const ADReal S_energy = S_momentum * uvec; 58 : 59 34148 : _residual[VolumeJunction1Phase::RHOUV_INDEX] -= S_momentum(0); 60 34148 : _residual[VolumeJunction1Phase::RHOVV_INDEX] -= S_momentum(1); 61 34148 : _residual[VolumeJunction1Phase::RHOWV_INDEX] -= S_momentum(2); 62 34148 : _residual[VolumeJunction1Phase::RHOEV_INDEX] -= S_energy; 63 34148 : }