https://mooseframework.inl.gov
CoupledConvectiveHeatFluxBC.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 
13 
16 {
18  params.addClassDescription(
19  "Convective heat transfer boundary condition with temperature and heat "
20  "transfer coefficent given by auxiliary variables.");
21  params.addCoupledVar("scale_factor", 1., "Scale factor to multiply the heat flux with");
22  params.addCoupledVar("alpha", 1., "Volume fraction of components");
23  params.addRequiredCoupledVar("T_infinity", "Field holding far-field temperature");
24  params.addRequiredCoupledVar("htc", "Heat transfer coefficient");
25 
26  return params;
27 }
28 
30  : IntegratedBC(parameters),
31  _n_components(coupledComponents("T_infinity")),
32  _T_infinity(coupledValues("T_infinity")),
33  _htc(coupledValues("htc")),
34  _alpha(coupledValues("alpha")),
35  _scale_factor(coupledValue("scale_factor"))
36 {
37  if (coupledComponents("alpha") != _n_components)
38  paramError(
39  "alpha",
40  "The number of coupled components does not match the number of `T_infinity` components.");
41  if (coupledComponents("htc") != _n_components)
42  paramError(
43  "htc",
44  "The number of coupled components does not match the number of `T_infinity` components.");
45 }
46 
47 Real
49 {
50  Real q = 0;
51  for (std::size_t c = 0; c < _n_components; c++)
52  q += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * (_u[_qp] - (*_T_infinity[c])[_qp]);
53  return _test[_i][_qp] * q * _scale_factor[_qp];
54 }
55 
56 Real
58 {
59  Real dq = 0;
60  for (std::size_t c = 0; c < _n_components; c++)
61  dq += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * _phi[_j][_qp];
62  return _test[_i][_qp] * dq * _scale_factor[_qp];
63 }
const VariableTestValue & _test
unsigned int _j
CoupledConvectiveHeatFluxBC(const InputParameters &parameters)
static InputParameters validParams()
unsigned int _i
const std::vector< const VariableValue * > _htc
Convective heat transfer coefficient.
const VariablePhiValue & _phi
const VariableValue & _scale_factor
Scale factor.
unsigned int _qp
static InputParameters validParams()
const unsigned int _n_components
The number of components.
void paramError(const std::string &param, Args... args) const
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
registerMooseObject("HeatTransferApp", CoupledConvectiveHeatFluxBC)
unsigned int coupledComponents(const std::string &var_name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addClassDescription(const std::string &doc_string)
const std::vector< const VariableValue * > _T_infinity
Far-field temperature fields for each component.
const std::vector< const VariableValue * > _alpha
Volume fraction of individual phase.
const VariableValue & _u
Boundary condition for convective heat flux where temperature and heat transfer coefficient are given...