LCOV - code coverage report
Current view: top level - src/postprocessors - SubChannelPointValue.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 32 33 97.0 %
Date: 2025-09-04 07:58:06 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 "SubChannelPointValue.h"
      11             : #include "FEProblemBase.h"
      12             : #include "Function.h"
      13             : #include "MooseMesh.h"
      14             : #include "MooseVariable.h"
      15             : #include "SubProblem.h"
      16             : #include "libmesh/system.h"
      17             : #include "SCM.h"
      18             : 
      19             : registerMooseObject("SubChannelApp", SubChannelPointValue);
      20             : 
      21             : InputParameters
      22        1840 : SubChannelPointValue::validParams()
      23             : {
      24        1840 :   InputParameters params = GeneralPostprocessor::validParams();
      25        3680 :   params.addRequiredParam<VariableName>("variable", "Variable you want the value of");
      26        3680 :   params.addRequiredParam<Real>("height", "Axial location of point [m]");
      27        3680 :   params.addRequiredParam<int>("index", "Index of subchannel");
      28        1840 :   params.addClassDescription(
      29             :       "Prints out a user selected value of a specified subchannel at a user selected axial height");
      30        1840 :   return params;
      31           0 : }
      32             : 
      33         920 : SubChannelPointValue::SubChannelPointValue(const InputParameters & parameters)
      34             :   : GeneralPostprocessor(parameters),
      35         920 :     _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
      36        1840 :     _height(getParam<Real>("height")),
      37        1840 :     _i_ch(getParam<int>("index")),
      38        1840 :     _var_number(_subproblem
      39         920 :                     .getVariable(_tid,
      40         920 :                                  parameters.get<VariableName>("variable"),
      41             :                                  Moose::VarKindType::VAR_ANY,
      42             :                                  Moose::VarFieldType::VAR_FIELD_STANDARD)
      43             :                     .number()),
      44        1840 :     _system(_subproblem.getSystem(getParam<VariableName>("variable"))),
      45         920 :     _value(0)
      46             : {
      47         920 :   _point =
      48         920 :       Point(_mesh._subchannel_position[_i_ch][0], _mesh._subchannel_position[_i_ch][1], _height);
      49         920 : }
      50             : 
      51             : void
      52        1398 : SubChannelPointValue::execute()
      53             : {
      54        1398 :   _value = _system.point_value(_var_number, _point, false);
      55             : 
      56        1398 :   if (MooseUtils::absoluteFuzzyEqual(_value, 0.0))
      57             :   {
      58          68 :     auto pl = _subproblem.mesh().getPointLocator();
      59          68 :     pl->enable_out_of_mesh_mode();
      60          68 :     auto * elem = (*pl)(_point);
      61         134 :     auto elem_id = elem ? elem->id() : DofObject::invalid_id;
      62             :     gatherMin(elem_id);
      63          68 :     if (elem_id == DofObject::invalid_id)
      64           2 :       mooseError(name(), " height: No element located at given height.");
      65          66 :   }
      66        1396 : }
      67             : 
      68             : Real
      69        1396 : SubChannelPointValue::getValue() const
      70             : {
      71        1396 :   return _value;
      72             : }

Generated by: LCOV version 1.14