LCOV - code coverage report
Current view: top level - src/actioncomponents - InjectionWell.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 51 52 98.1 %
Date: 2026-05-29 20:41:18 Functions: 6 6 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 "InjectionWell.h"
      11             : 
      12             : registerTHMActionComponentTasks("ThermalHydraulicsApp", InjectionWell);
      13             : registerActionComponent("ThermalHydraulicsApp", InjectionWell);
      14             : 
      15             : InputParameters
      16           9 : InjectionWell::validParams()
      17             : {
      18           9 :   InputParameters params = WellBase::validParams();
      19             : 
      20          18 :   params.addRequiredParam<FunctionName>("inlet_mass_flow_rate",
      21             :                                         "Inlet mass flow rate function [kg/s]");
      22          18 :   params.addRequiredParam<FunctionName>("inlet_temperature", "Inlet temperature function [K]");
      23             : 
      24           9 :   params.addClassDescription("Adds the components and controls for an injection well.");
      25             : 
      26           9 :   return params;
      27           0 : }
      28             : 
      29           9 : InjectionWell::InjectionWell(const InputParameters & params) : WellBase(params) {}
      30             : 
      31             : void
      32           9 : InjectionWell::addTHMComponents()
      33             : {
      34           9 :   addWellBaseComponents(false);
      35           9 :   addInlet();
      36           9 : }
      37             : 
      38             : void
      39           9 : InjectionWell::addControlLogic()
      40             : {
      41             :   // m_dot
      42           9 :   const std::string get_mdot_fn_name = name() + "_get_inlet_mdot_ctrl";
      43             :   {
      44           9 :     const std::string class_name = "GetFunctionValueControl";
      45           9 :     auto params = _factory.getValidParams(class_name);
      46          27 :     params.set<FunctionName>("function") = getParam<FunctionName>("inlet_mass_flow_rate");
      47           9 :     params.set<Point>("point") = _surface_point;
      48           9 :     addControlLogicObject(class_name, get_mdot_fn_name, params);
      49           9 :   }
      50             :   {
      51           9 :     const std::string class_name = "SetComponentRealValueControl";
      52           9 :     auto params = _factory.getValidParams(class_name);
      53          18 :     params.set<std::string>("component") = inletName();
      54           9 :     params.set<std::string>("parameter") = "m_dot";
      55          18 :     params.set<std::string>("value") = get_mdot_fn_name + ":value";
      56           9 :     addControlLogicObject(class_name, name() + "_set_inlet_mdot_ctrl", params);
      57           9 :   }
      58             : 
      59             :   // T
      60           9 :   const std::string get_T_fn_name = name() + "_get_inlet_T_ctrl";
      61             :   {
      62           9 :     const std::string class_name = "GetFunctionValueControl";
      63           9 :     auto params = _factory.getValidParams(class_name);
      64          27 :     params.set<FunctionName>("function") = getParam<FunctionName>("inlet_temperature");
      65           9 :     params.set<Point>("point") = _surface_point;
      66           9 :     addControlLogicObject(class_name, get_T_fn_name, params);
      67           9 :   }
      68             :   {
      69           9 :     const std::string class_name = "SetComponentRealValueControl";
      70           9 :     auto params = _factory.getValidParams(class_name);
      71          18 :     params.set<std::string>("component") = inletName();
      72           9 :     params.set<std::string>("parameter") = "T";
      73          18 :     params.set<std::string>("value") = get_T_fn_name + ":value";
      74           9 :     addControlLogicObject(class_name, name() + "_set_inlet_T_ctrl", params);
      75           9 :   }
      76           9 : }
      77             : 
      78             : void
      79           9 : InjectionWell::addInlet()
      80             : {
      81           9 :   const std::string class_name = "InletMassFlowRateTemperature1Phase";
      82           9 :   auto params = _factory.getValidParams(class_name);
      83          27 :   params.set<BoundaryName>("input") = flowChannelName(0) + ":in";
      84           9 :   params.set<Real>("m_dot") = 0.0; // arbitrary placeholder value; this gets controlled
      85           9 :   params.set<Real>("T") = 300.0;   // arbitrary placeholder value; this gets controlled
      86           9 :   addTHMComponent(class_name, inletName(), params);
      87          18 : }
      88             : 
      89             : std::string
      90          27 : InjectionWell::inletName() const
      91             : {
      92          27 :   return name() + "_inlet";
      93             : }

Generated by: LCOV version 1.14