LCOV - code coverage report
Current view: top level - src/components - FormLoss1PhaseBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 27 28 96.4 %
Date: 2025-07-30 13:02:48 Functions: 5 5 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 "FormLoss1PhaseBase.h"
      11             : #include "FlowModelSinglePhase.h"
      12             : #include "FlowChannel1Phase.h"
      13             : 
      14             : InputParameters
      15          68 : FormLoss1PhaseBase::validParams()
      16             : {
      17          68 :   InputParameters params = Component::validParams();
      18         136 :   params.addRequiredParam<std::string>("flow_channel",
      19             :                                        "Flow channel where form loss will be applied");
      20          68 :   params.addClassDescription("Base class for prescribing a form loss over a 1-phase flow channel");
      21             : 
      22          68 :   return params;
      23           0 : }
      24             : 
      25          34 : FormLoss1PhaseBase::FormLoss1PhaseBase(const InputParameters & params)
      26          68 :   : Component(params), _flow_channel_name(getParam<std::string>("flow_channel"))
      27             : {
      28          34 : }
      29             : 
      30             : void
      31          34 : FormLoss1PhaseBase::init()
      32             : {
      33             :   Component::init();
      34             : 
      35          34 :   if (hasComponentByName<FlowChannel1Phase>(_flow_channel_name))
      36             :   {
      37             :     const FlowChannel1Phase & fch = getComponentByName<FlowChannel1Phase>(_flow_channel_name);
      38          34 :     _flow_channel_subdomains = fch.getSubdomainNames();
      39             :   }
      40          34 : }
      41             : 
      42             : void
      43          34 : FormLoss1PhaseBase::check() const
      44             : {
      45          34 :   checkComponentOfTypeExistsByName<FlowChannel1Phase>(_flow_channel_name);
      46          34 : }
      47             : 
      48             : void
      49          34 : FormLoss1PhaseBase::addMooseObjects()
      50             : {
      51             :   {
      52          34 :     const std::string class_name = "ADOneD3EqnMomentumFormLoss";
      53          34 :     InputParameters params = _factory.getValidParams(class_name);
      54          68 :     params.set<NonlinearVariableName>("variable") = FlowModelSinglePhase::RHOUA;
      55          68 :     params.set<std::vector<SubdomainName>>("block") = _flow_channel_subdomains;
      56         102 :     params.set<std::vector<VariableName>>("A") = {FlowModel::AREA};
      57          68 :     params.set<MaterialPropertyName>("rho") = FlowModelSinglePhase::DENSITY;
      58          68 :     params.set<MaterialPropertyName>("vel") = FlowModelSinglePhase::VELOCITY;
      59          68 :     getTHMProblem().addKernel(
      60          34 :         class_name, genName(name(), FlowModelSinglePhase::RHOUA, "form_loss"), params);
      61          34 :   }
      62          34 : }

Generated by: LCOV version 1.14