https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SCMTHPowerPostprocessor.C
Go to the documentation of this file.
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
11#include "FEProblemBase.h"
12#include "SolutionHandle.h"
13#include "MooseMesh.h"
14#include "SCM.h"
16
18
21{
24 "Calculates the total power of the subchannel assembly $[W]$ via the "
25 "thermal-hydraulic enthalpy flow rate balance between inlet and outlet.");
26 return params;
27}
28
30 : GeneralPostprocessor(parameters),
31 _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
32 _value(0)
33{
34}
35
36void
38{
39 const auto scm_problem = dynamic_cast<SubChannel1PhaseProblem *>(&_fe_problem);
40 const auto n_channels = _mesh.getNumOfChannels();
42 auto mdot_soln = SolutionHandle(_fe_problem.getVariable(0, "mdot"));
43 auto h_soln = SolutionHandle(_fe_problem.getVariable(0, "h"));
44
45 if (!scm_problem)
46 mooseError("SCMTHPowerPostprocessor can only be used within a subchannel 1phase problem.");
47
48 Real power_in = 0.0;
49 Real power_out = 0.0;
50
51 for (unsigned int i_ch = 0; i_ch < n_channels; i_ch++)
52 {
53 auto * node_in = _mesh.getChannelNode(i_ch, 0);
54 auto * node_out = _mesh.getChannelNode(i_ch, n_cells);
55
56 const Real mdot_in = mdot_soln(node_in);
57 const Real h_in = h_soln(node_in);
58 const Real mdot_out = mdot_soln(node_out);
59 const Real h_out = h_soln(node_out);
60
61 power_in += mdot_in * h_in;
62 power_out += mdot_out * h_out;
63 }
64
65 _value = power_out - power_in;
66}
67
68Real
70{
71 return _value;
72}
registerMooseObject("SubChannelApp", SCMTHPowerPostprocessor)
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
Calculates the total power of the subchannel assembly $[W]$ considering the thermal-hydraulic balance...
Real _value
value we want to calculate
const SubChannelMesh & _mesh
geometric information
SCMTHPowerPostprocessor(const InputParameters &params)
virtual Real getValue() const override
virtual void execute() override
static InputParameters validParams()
Provide a simple RAII interface for linear lagrange solution variables.
Base class for the 1-phase steady-state/transient subchannel solver.
Base class for subchannel meshes.
virtual unsigned int getNumOfChannels() const =0
Return the number of channels per layer.
virtual Node * getChannelNode(unsigned int i_chan, unsigned int iz) const =0
Get the subchannel mesh node for a given channel index and elevation index.
virtual unsigned int getNumOfAxialCells() const
Return the number of axial cells.
FEProblemBase & _fe_problem
MeshBase & mesh
Definition SCM.h:17
dof_id_type n_cells