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 SCM::getConstProblem<SubChannel1PhaseProblem>(_fe_problem);
35}
36
37void
39{
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 Real power_in = 0.0;
46 Real power_out = 0.0;
47
48 for (unsigned int i_ch = 0; i_ch < n_channels; i_ch++)
49 {
50 auto * node_in = _mesh.getChannelNode(i_ch, 0);
51 auto * node_out = _mesh.getChannelNode(i_ch, n_cells);
52
53 const Real mdot_in = mdot_soln(node_in);
54 const Real h_in = h_soln(node_in);
55 const Real mdot_out = mdot_soln(node_out);
56 const Real h_out = h_soln(node_out);
57
58 power_in += mdot_in * h_in;
59 power_out += mdot_out * h_out;
60 }
61
62 _value = power_out - power_in;
63}
64
65void
67{
68 // The subchannel solution is only available on processor 0
70}
71
72Real
74{
75 return _value;
76}
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)
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 void finalize() override
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 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.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
FEProblemBase & _fe_problem
const Parallel::Communicator & _communicator
MeshBase & mesh
Definition SCM.h:18
dof_id_type n_cells