https://mooseframework.inl.gov
RayleighNumber.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 
10 #include "RayleighNumber.h"
11 
12 registerMooseObject("NavierStokesApp", RayleighNumber);
13 
16 {
18 
19  params.addClassDescription("Postprocessor that computes the Rayleigh number for free flow with "
20  "natural circulation");
21 
22  // Compute it from a density change
23  params.addRequiredParam<PostprocessorName>("rho_ave", "Average density");
24  params.addParam<PostprocessorName>("rho_min", "Minimum density");
25  params.addParam<PostprocessorName>("rho_max", "Maximum density");
26 
27  // Compute it from a temperature change
28  params.addParam<PostprocessorName>("beta",
29  "Absolute value of fluid volumetric expansion coefficient");
30  params.addParam<PostprocessorName>("T_hot", "Maximum temperature, or hot source temperature");
31  params.addParam<PostprocessorName>("T_cold", "Minimum temperature, or cold source temperature");
32 
33  params.addRequiredParam<PostprocessorName>("l", "Characteristic distance");
34  params.addRequiredParam<PostprocessorName>("mu_ave", "Average value of the dynamic viscosity");
35  params.addRequiredParam<PostprocessorName>("k_ave", "Average value of the thermal conductivity");
36  params.addRequiredParam<PostprocessorName>("cp_ave",
37  "Average value of the specific thermal capacity");
38  params.addRequiredParam<Real>("gravity_magnitude",
39  "Gravity vector magnitude in the direction of interest");
40 
41  return params;
42 }
43 
45  : GeneralPostprocessor(parameters),
46  _rho_min(isParamValid("rho_min") ? &getPostprocessorValue("rho_min") : nullptr),
47  _rho_max(isParamValid("rho_max") ? &getPostprocessorValue("rho_max") : nullptr),
48  _rho_ave(getPostprocessorValue("rho_ave")),
49  _beta(isParamValid("beta") ? &getPostprocessorValue("beta") : nullptr),
50  _T_hot(isParamValid("T_hot") ? &getPostprocessorValue("T_hot") : nullptr),
51  _T_cold(isParamValid("T_cold") ? &getPostprocessorValue("T_cold") : nullptr),
52  _l(getPostprocessorValue("l")),
53  _mu(getPostprocessorValue("mu_ave")),
54  _k(getPostprocessorValue("k_ave")),
55  _cp(getPostprocessorValue("cp_ave")),
56  _gravity(getParam<Real>("gravity_magnitude"))
57 {
58  // Check that enough information has been given
59  if ((!_rho_ave || !_rho_min || !_rho_max) && (!_rho_ave || !_beta || !_T_hot || !_T_cold))
60  mooseError("To compute the density difference for the Rayleigh number, the density "
61  "min/max/average or the expansion coefficient and the temperature min/max "
62  "must be provided.");
63 }
64 
65 Real
67 {
68  Real drho;
69  if (_rho_min)
70  drho = *_rho_max - *_rho_min;
71  else
72  drho = *_beta * (*_T_hot - *_T_cold) * _rho_ave;
73 
74  if (_mu <= 0 || _k <= 0 || _rho_ave <= 0)
75  mooseError("Average viscosity, density and thermal conductivity should be strictly positive");
76 
77  return drho * std::pow(_l, 3) * _gravity * _cp * _rho_ave / (_mu * _k);
78 }
const PostprocessorValue & _cp
Average specific thermal capacity.
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const PostprocessorValue *const _beta
Thermal expansion coefficient.
const PostprocessorValue & _rho_ave
Average density.
const PostprocessorValue *const _T_cold
Minimum temperature.
const PostprocessorValue & _mu
Average viscosity.
registerMooseObject("NavierStokesApp", RayleighNumber)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
virtual Real getValue() const override
const PostprocessorValue & _l
Characteristic length.
const PostprocessorValue *const _rho_max
Maximum density.
This postprocessor computes the Rayleigh number to describe natural circulation.
const PostprocessorValue *const _rho_min
Minimum density.
static InputParameters validParams()
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const PostprocessorValue *const _T_hot
Maximum temperature.
void mooseError(Args &&... args) const
const Real _gravity
Magnitude of gravity in the direction of interest.
void addClassDescription(const std::string &doc_string)
const PostprocessorValue & _k
Average thermal conductivity.
MooseUnits pow(const MooseUnits &, int)
RayleighNumber(const InputParameters &parameters)