https://mooseframework.inl.gov
Loading...
Searching...
No Matches
SCMInletConductionHeatRatePostprocessor.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"
18
20
23{
26 "Calculates the surface integrated heat flux (W) that axial conduction carries out of the "
27 "assembly through "
28 "the inlet, against the flow. It closes the energy balance between the pin and duct heat "
29 "rates and the enthalpy flow rate rise of SCMTHPowerPostprocessor.");
30 return params;
31}
32
34 const InputParameters & parameters)
35 : GeneralPostprocessor(parameters),
36 _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
37 _value(0)
38{
39 // The explicit solve conducts temperature with its own stencil, which differs from the implicit
40 // enthalpy stencil this postprocessor evaluates, so its result would not be the solver's flux
41 const auto scm_problem = dynamic_cast<const SubChannel1PhaseProblem *>(&_fe_problem);
42 if (scm_problem && !scm_problem->isImplicit())
43 mooseError("SCMInletConductionHeatRatePostprocessor supports only the implicit solve "
44 "('implicit = true').");
45}
46
47void
49{
50 const auto scm_problem = dynamic_cast<SubChannel1PhaseProblem *>(&_fe_problem);
51 if (!scm_problem)
52 mooseError("SCMInletConductionHeatRatePostprocessor can only be used within a subchannel "
53 "1phase problem.");
54
55 // Only the triangular assembly assembles axial heat conduction. A quadrilateral assembly has no
56 // conduction term, so none of its heat leaves through the inlet this way.
57 if (!dynamic_cast<TriSubChannel1PhaseProblem *>(&_fe_problem))
58 {
59 _value = 0.0;
60 return;
61 }
62
63 const auto n_channels = _mesh.getNumOfChannels();
64 const auto & z_grid = _mesh.getZGrid();
65 const auto * fp = scm_problem->getSinglePhaseFluidProperties();
66 auto h_soln = SolutionHandle(_fe_problem.getVariable(0, "h"));
67 auto T_soln = SolutionHandle(_fe_problem.getVariable(0, "T"));
68 auto P_soln = SolutionHandle(_fe_problem.getVariable(0, "P"));
69 auto S_soln = SolutionHandle(_fe_problem.getVariable(0, "S"));
70 const Real P_out = scm_problem->getOutletPressure();
71
72 // The thermal diffusivity k / cp of the enthalpy equation, evaluated as the solver does
73 auto diffusivity = [&](const Node * node)
74 {
75 const Real p = P_soln(node) + P_out;
76 const Real T = T_soln(node);
77 return fp->k_from_p_T(p, T) / fp->cp_from_p_T(p, T);
78 };
79
80 // The conduction flux of the first cell, with the same face interpolation the enthalpy assembly
81 // uses. A positive value leaves the assembly, since the first node is hotter than the prescribed
82 // inlet.
83 Real heat_rate = 0.0;
84 for (const auto i_ch : make_range(n_channels))
85 {
86 const auto * node_in = _mesh.getChannelNode(i_ch, 0);
87 const auto * node_out = _mesh.getChannelNode(i_ch, 1);
88 const Real dz = z_grid[1] - z_grid[0];
89 const Real S_face = scm_problem->interpolateFaceValue(S_soln(node_out), S_soln(node_in));
90 const Real diff_face =
91 scm_problem->interpolateFaceValue(diffusivity(node_out), diffusivity(node_in));
92 heat_rate += diff_face * S_face * (h_soln(node_out) - h_soln(node_in)) / dz;
93 }
94
95 _value = heat_rate;
96}
97
98void
100{
101 // The subchannel solution is only available on processor 0
103}
104
105Real
const Real p
const double T
registerMooseObject("SubChannelApp", SCMInletConductionHeatRatePostprocessor)
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 surface-integrated heat flux $[W]$ that axial conduction carries out of the assembly t...
Real _value
heat rate conducted out of the inlet [W]
const SubChannelMesh & _mesh
geometric information
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 const std::vector< Real > & getZGrid() const
Get axial location of layers.
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.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
Triangular subchannel solver.
FEProblemBase & _fe_problem
const Parallel::Communicator & _communicator
MeshBase & mesh
Definition SCM.h:18