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 "ADBoundaryFlux3EqnGhostPressure.h" 11 : #include "SinglePhaseFluidProperties.h" 12 : #include "THMIndicesVACE.h" 13 : #include "Numerics.h" 14 : 15 : registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnGhostPressure); 16 : 17 : InputParameters 18 3359 : ADBoundaryFlux3EqnGhostPressure::validParams() 19 : { 20 3359 : InputParameters params = ADBoundaryFlux3EqnGhostBase::validParams(); 21 : 22 3359 : params.addClassDescription("Computes boundary flux from a specified pressure for the 1-D, " 23 : "1-phase, variable-area Euler equations"); 24 : 25 6718 : params.addRequiredParam<Real>("p", "Pressure"); 26 : 27 6718 : params.addRequiredParam<UserObjectName>("fluid_properties", 28 : "Name of fluid properties user object"); 29 : 30 6718 : params.declareControllable("p"); 31 3359 : return params; 32 0 : } 33 : 34 1828 : ADBoundaryFlux3EqnGhostPressure::ADBoundaryFlux3EqnGhostPressure(const InputParameters & parameters) 35 : : ADBoundaryFlux3EqnGhostBase(parameters), 36 : 37 1828 : _p(getParam<Real>("p")), 38 3656 : _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties")) 39 : { 40 1828 : } 41 : 42 : std::vector<ADReal> 43 80579 : ADBoundaryFlux3EqnGhostPressure::getGhostCellSolution(const std::vector<ADReal> & U) const 44 : { 45 80579 : const ADReal rhoA = U[THMVACE1D::RHOA]; 46 80579 : const ADReal rhouA = U[THMVACE1D::RHOUA]; 47 80579 : const ADReal A = U[THMVACE1D::AREA]; 48 : 49 : const ADReal rho = rhoA / A; 50 : const ADReal vel = rhouA / rhoA; 51 161158 : const ADReal E = _fp.e_from_p_rho(_p, rho) + 0.5 * vel * vel; 52 : 53 80579 : std::vector<ADReal> U_ghost(THMVACE1D::N_FLUX_INPUTS); 54 80579 : U_ghost[THMVACE1D::RHOA] = rhoA; 55 80579 : U_ghost[THMVACE1D::RHOUA] = rhouA; 56 80579 : U_ghost[THMVACE1D::RHOEA] = rhoA * E; 57 80579 : U_ghost[THMVACE1D::AREA] = A; 58 : 59 : return U_ghost; 60 : }