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 1733 : ADBoundaryFlux3EqnGhostPressure::validParams() 19 : { 20 1733 : InputParameters params = ADBoundaryFlux3EqnGhostBase::validParams(); 21 : 22 1733 : params.addClassDescription("Computes boundary flux from a specified pressure for the 1-D, " 23 : "1-phase, variable-area Euler equations"); 24 : 25 3466 : params.addRequiredParam<Real>("p", "Pressure"); 26 : 27 3466 : params.addRequiredParam<UserObjectName>("fluid_properties", 28 : "Name of fluid properties user object"); 29 : 30 3466 : params.declareControllable("p"); 31 1733 : return params; 32 0 : } 33 : 34 922 : ADBoundaryFlux3EqnGhostPressure::ADBoundaryFlux3EqnGhostPressure(const InputParameters & parameters) 35 : : ADBoundaryFlux3EqnGhostBase(parameters), 36 : 37 922 : _p(getParam<Real>("p")), 38 1844 : _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties")) 39 : { 40 922 : } 41 : 42 : std::vector<ADReal> 43 49270 : ADBoundaryFlux3EqnGhostPressure::getGhostCellSolution(const std::vector<ADReal> & U, 44 : const Point & /*point*/) const 45 : { 46 49270 : const ADReal rhoA = U[THMVACE1D::RHOA]; 47 49270 : const ADReal rhouA = U[THMVACE1D::RHOUA]; 48 49270 : const ADReal A = U[THMVACE1D::AREA]; 49 : 50 : const ADReal rho = rhoA / A; 51 : const ADReal vel = rhouA / rhoA; 52 98540 : const ADReal E = _fp.e_from_p_rho(_p, rho) + 0.5 * vel * vel; 53 : 54 49270 : auto U_ghost = U; 55 49270 : U_ghost[THMVACE1D::RHOEA] = rhoA * E; 56 : 57 49270 : return U_ghost; 58 0 : }