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

Generated by: LCOV version 1.14