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

Generated by: LCOV version 1.14