LCOV - code coverage report
Current view: top level - src/components - InletDensityVelocity1Phase.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 34 36 94.4 %
Date: 2026-05-29 20:41:18 Functions: 4 4 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 "InletDensityVelocity1Phase.h"
      11             : #include "FlowModelSinglePhase.h"
      12             : 
      13             : registerMooseObject("ThermalHydraulicsApp", InletDensityVelocity1Phase);
      14             : 
      15             : InputParameters
      16         236 : InletDensityVelocity1Phase::validParams()
      17             : {
      18         236 :   InputParameters params = FlowBoundary1Phase::validParams();
      19         472 :   params.addRequiredParam<Real>("rho", "Prescribed density [kg/m^3]");
      20         472 :   params.addRequiredParam<Real>("vel", "Prescribed velocity [m/s]");
      21         472 :   params.addParam<bool>("reversible", true, "True for reversible, false for pure inlet");
      22         472 :   params.declareControllable("rho vel");
      23         236 :   params.addClassDescription(
      24             :       "Boundary condition with prescribed density and velocity for 1-phase flow channels.");
      25         236 :   return params;
      26           0 : }
      27             : 
      28         118 : InletDensityVelocity1Phase::InletDensityVelocity1Phase(const InputParameters & params)
      29         236 :   : FlowBoundary1Phase(params), _reversible(getParam<bool>("reversible"))
      30             : {
      31         118 : }
      32             : 
      33             : void
      34         116 : InletDensityVelocity1Phase::check() const
      35             : {
      36         116 :   FlowBoundary1Phase::check();
      37             : 
      38         116 :   auto fm = dynamic_cast<const FlowModelSinglePhase *>(_flow_model.get());
      39         116 :   if (fm == nullptr)
      40           0 :     logError("Incompatible flow model. Make sure you use this component with single phase flow "
      41             :              "channel.");
      42         116 : }
      43             : 
      44             : void
      45         118 : InletDensityVelocity1Phase::addMooseObjects()
      46             : {
      47         118 :   ExecFlagEnum execute_on(MooseUtils::getDefaultExecFlagEnum());
      48         590 :   execute_on = {EXEC_INITIAL, EXEC_LINEAR, EXEC_NONLINEAR};
      49             : 
      50             :   // boundary flux user object
      51             :   {
      52         118 :     const std::string class_name = "ADBoundaryFlux3EqnGhostDensityVelocity";
      53         118 :     InputParameters params = _factory.getValidParams(class_name);
      54         236 :     params.set<Real>("rho") = getParam<Real>("rho");
      55         236 :     params.set<Real>("vel") = getParam<Real>("vel");
      56         118 :     params.set<Real>("normal") = _normal;
      57         118 :     params.set<bool>("reversible") = _reversible;
      58         118 :     params.set<UserObjectName>("fluid_properties") = _fp_name;
      59         118 :     params.set<UserObjectName>("numerical_flux") = _numerical_flux_name;
      60         118 :     params.set<ExecFlagEnum>("execute_on") = execute_on;
      61         118 :     getTHMProblem().addUserObject(class_name, _boundary_uo_name, params);
      62             : 
      63         118 :     connectObject(params, _boundary_uo_name, "rho");
      64         118 :     connectObject(params, _boundary_uo_name, "vel");
      65         118 :   }
      66             : 
      67             :   // BCs
      68         118 :   addWeakBCs();
      69         236 : }

Generated by: LCOV version 1.14