https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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
65Real
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}
registerMooseObject("NavierStokesApp", RayleighNumber)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void mooseError(Args &&... args) const
This postprocessor computes the Rayleigh number to describe natural circulation.
const PostprocessorValue & _mu
Average viscosity.
const PostprocessorValue & _cp
Average specific thermal capacity.
static InputParameters validParams()
const PostprocessorValue *const _beta
Thermal expansion coefficient.
RayleighNumber(const InputParameters &parameters)
const PostprocessorValue & _k
Average thermal conductivity.
const PostprocessorValue & _rho_ave
Average density.
virtual Real getValue() const override
const PostprocessorValue *const _rho_min
Minimum density.
const PostprocessorValue *const _rho_max
Maximum density.
const PostprocessorValue & _l
Characteristic length.
const PostprocessorValue *const _T_hot
Maximum temperature.
const PostprocessorValue *const _T_cold
Minimum temperature.
const Real _gravity
Magnitude of gravity in the direction of interest.