LCOV - code coverage report
Current view: top level - src/postprocessors - SCMPowerPostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 20 22 90.9 %
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 "SCMPowerPostprocessor.h"
      11             : #include "FEProblemBase.h"
      12             : #include "MooseMesh.h"
      13             : #include "SCM.h"
      14             : #include "SubChannel1PhaseProblem.h"
      15             : 
      16             : registerMooseObject("SubChannelApp", SCMPowerPostprocessor);
      17             : 
      18             : InputParameters
      19          96 : SCMPowerPostprocessor::validParams()
      20             : {
      21          96 :   InputParameters params = GeneralPostprocessor::validParams();
      22          96 :   params.addClassDescription(
      23             :       "Calculates the total power of the assembly based on the distribution of variable q_prime");
      24          96 :   return params;
      25           0 : }
      26             : 
      27          48 : SCMPowerPostprocessor::SCMPowerPostprocessor(const InputParameters & parameters)
      28             :   : GeneralPostprocessor(parameters),
      29          48 :     _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
      30          48 :     _value(0)
      31             : {
      32          48 : }
      33             : 
      34             : void
      35          48 : SCMPowerPostprocessor::execute()
      36             : {
      37          48 :   const auto scm_problem = dynamic_cast<SubChannel1PhaseProblem *>(&_fe_problem);
      38          48 :   const auto nz = _mesh.getNumOfAxialCells();
      39          48 :   const auto n_channels = _mesh.getNumOfChannels();
      40          48 :   if (!scm_problem)
      41           0 :     mooseError("SCMPowerPostprocessor can only be used within a subchannel 1phase problem.");
      42             :   auto power = 0.0;
      43        1212 :   for (unsigned int iz = 1; iz < nz + 1; iz++)
      44       39756 :     for (unsigned int i_ch = 0; i_ch < n_channels; i_ch++)
      45       38592 :       power += scm_problem->computeAddedHeatPin(i_ch, iz);
      46          48 :   _value = power;
      47          48 : }
      48             : 
      49             : Real
      50          48 : SCMPowerPostprocessor::getValue() const
      51             : {
      52          48 :   return _value;
      53             : }

Generated by: LCOV version 1.14