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 "ADFlowBoundaryFlux1Phase.h" 11 : #include "ADBoundaryFluxBase.h" 12 : #include "THMIndicesVACE.h" 13 : 14 : registerMooseObject("ThermalHydraulicsApp", ADFlowBoundaryFlux1Phase); 15 : 16 : InputParameters 17 926 : ADFlowBoundaryFlux1Phase::validParams() 18 : { 19 926 : InputParameters params = SideIntegralPostprocessor::validParams(); 20 1852 : MooseEnum equation("mass=0 momentum=1 energy=2"); 21 1852 : params.addRequiredParam<MooseEnum>( 22 : "equation", equation, "Equation for which to query flux vector"); 23 1852 : params.addCoupledVar("variables", "Single-phase flow variables"); 24 5556 : params.set<std::vector<VariableName>>("variables") = {"rhoA", "rhouA", "rhoEA", "A"}; 25 926 : params.addClassDescription( 26 : "Retrieves an entry of a flux vector for a connection attached to a 1-phase junction"); 27 : 28 926 : return params; 29 926 : } 30 : 31 350 : ADFlowBoundaryFlux1Phase::ADFlowBoundaryFlux1Phase(const InputParameters & parameters) 32 : : SideIntegralPostprocessor(parameters), 33 350 : _n_components(THMVACE1D::N_FLUX_INPUTS), 34 700 : _boundary_name(getParam<std::vector<BoundaryName>>("boundary")[0]), 35 350 : _boundary_uo_name(_boundary_name + ":boundary_uo"), 36 350 : _boundary_uo(getUserObjectByName<ADBoundaryFluxBase>(_boundary_uo_name)), 37 1050 : _equation_index(getParam<MooseEnum>("equation")) 38 : { 39 1750 : for (unsigned int i = 0; i < _n_components; i++) 40 2800 : _U.push_back(&adCoupledValue("variables", i)); 41 350 : } 42 : 43 : Real 44 2559 : ADFlowBoundaryFlux1Phase::computeQpIntegral() 45 : { 46 2559 : std::vector<ADReal> U(_n_components); 47 12795 : for (unsigned int i = 0; i < _n_components; i++) 48 10236 : U[i] = (*_U[i])[_qp]; 49 : 50 2559 : const auto & flux = _boundary_uo.getFlux(_current_side, _current_elem->id(), U, _normals[_qp]); 51 2559 : return MetaPhysicL::raw_value(flux[_equation_index]); 52 : }