LCOV - code coverage report
Current view: top level - src/userobjects - ADBoundaryFlux3EqnFreeOutflow.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 21 22 95.5 %
Date: 2025-07-30 13:02:48 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          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 "ADBoundaryFlux3EqnFreeOutflow.h"
      11             : #include "THMIndicesVACE.h"
      12             : #include "Numerics.h"
      13             : 
      14             : registerMooseObject("ThermalHydraulicsApp", ADBoundaryFlux3EqnFreeOutflow);
      15             : 
      16             : InputParameters
      17         984 : ADBoundaryFlux3EqnFreeOutflow::validParams()
      18             : {
      19         984 :   InputParameters params = ADBoundaryFluxBase::validParams();
      20             : 
      21         984 :   params.addClassDescription("Computes the outflow boundary flux directly for the 1-D, 1-phase, "
      22             :                              "variable-area Euler equations");
      23             : 
      24        1968 :   params.addRequiredParam<UserObjectName>("fluid_properties",
      25             :                                           "Name of fluid properties user object");
      26             : 
      27         984 :   return params;
      28           0 : }
      29             : 
      30         533 : ADBoundaryFlux3EqnFreeOutflow::ADBoundaryFlux3EqnFreeOutflow(const InputParameters & parameters)
      31             :   : ADBoundaryFluxBase(parameters),
      32             : 
      33         533 :     _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
      34             : {
      35         533 : }
      36             : 
      37             : void
      38        5352 : ADBoundaryFlux3EqnFreeOutflow::calcFlux(unsigned int /*iside*/,
      39             :                                         dof_id_type /*ielem*/,
      40             :                                         const std::vector<ADReal> & U1,
      41             :                                         const RealVectorValue & /*normal*/,
      42             :                                         std::vector<ADReal> & flux) const
      43             : {
      44             :   // extract the solution and area
      45        5352 :   const ADReal rhoA1 = U1[THMVACE1D::RHOA];
      46        5352 :   const ADReal rhouA1 = U1[THMVACE1D::RHOUA];
      47        5352 :   const ADReal rhoEA1 = U1[THMVACE1D::RHOEA];
      48        5352 :   const ADReal A1 = U1[THMVACE1D::AREA];
      49             : 
      50             :   const ADReal rho1 = rhoA1 / A1;
      51             :   const ADReal vel1 = rhouA1 / rhoA1;
      52        5352 :   const ADReal v1 = 1.0 / rho1;
      53        5352 :   const ADReal e1 = rhoEA1 / rhoA1 - 0.5 * vel1 * vel1;
      54        5352 :   const ADReal p1 = _fp.p_from_v_e(v1, e1);
      55             : 
      56        5352 :   flux.resize(THMVACE1D::N_FLUX_OUTPUTS);
      57        5352 :   flux[THMVACE1D::MASS] = vel1 * rhoA1;
      58        5352 :   flux[THMVACE1D::MOMENTUM] = (vel1 * rhouA1 + p1 * A1);
      59        5352 :   flux[THMVACE1D::ENERGY] = vel1 * (rhoEA1 + p1 * A1);
      60        5352 : }

Generated by: LCOV version 1.14