www.mooseframework.org
CoupledConvectiveHeatFluxBC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
15 
16 InputParameters
18 {
19  InputParameters params = IntegratedBC::validParams();
20  params.addClassDescription(
21  "Convective heat transfer boundary condition with temperature and heat "
22  "transfer coefficent given by auxiliary variables.");
23  params.addCoupledVar("alpha", 1., "Volume fraction of components");
24  params.addRequiredCoupledVar("T_infinity", "Field holding far-field temperature");
25  params.addRequiredCoupledVar("htc", "Heat transfer coefficient");
26 
27  return params;
28 }
29 
31  : IntegratedBC(parameters), _n_components(coupledComponents("T_infinity"))
32 {
33  if (coupledComponents("alpha") != _n_components)
34  paramError(
35  "alpha",
36  "The number of coupled components does not match the number of `T_infinity` components.");
37  if (coupledComponents("htc") != _n_components)
38  paramError(
39  "htc",
40  "The number of coupled components does not match the number of `T_infinity` components.");
41 
42  _htc.resize(_n_components);
43  _T_infinity.resize(_n_components);
44  _alpha.resize(_n_components);
45  for (std::size_t c = 0; c < _n_components; c++)
46  {
47  _htc[c] = &coupledValue("htc", c);
48  _T_infinity[c] = &coupledValue("T_infinity", c);
49  _alpha[c] = &coupledValue("alpha", c);
50  }
51 }
52 
53 Real
55 {
56  Real q = 0;
57  for (std::size_t c = 0; c < _n_components; c++)
58  q += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * (_u[_qp] - (*_T_infinity[c])[_qp]);
59  return _test[_i][_qp] * q;
60 }
61 
62 Real
64 {
65  Real dq = 0;
66  for (std::size_t c = 0; c < _n_components; c++)
67  dq += (*_alpha[c])[_qp] * (*_htc[c])[_qp] * _phi[_j][_qp];
68  return _test[_i][_qp] * dq;
69 }
CoupledConvectiveHeatFluxBC::computeQpJacobian
virtual Real computeQpJacobian()
Definition: CoupledConvectiveHeatFluxBC.C:63
CoupledConvectiveHeatFluxBC
Boundary condition for convective heat flux where temperature and heat transfer coefficient are given...
Definition: CoupledConvectiveHeatFluxBC.h:24
CoupledConvectiveHeatFluxBC::computeQpResidual
virtual Real computeQpResidual()
Definition: CoupledConvectiveHeatFluxBC.C:54
CoupledConvectiveHeatFluxBC.h
defineLegacyParams
defineLegacyParams(CoupledConvectiveHeatFluxBC)
registerMooseObject
registerMooseObject("HeatConductionApp", CoupledConvectiveHeatFluxBC)
CoupledConvectiveHeatFluxBC::CoupledConvectiveHeatFluxBC
CoupledConvectiveHeatFluxBC(const InputParameters &parameters)
Definition: CoupledConvectiveHeatFluxBC.C:30
CoupledConvectiveHeatFluxBC::_alpha
std::vector< const VariableValue * > _alpha
Volume fraction of individual phase.
Definition: CoupledConvectiveHeatFluxBC.h:42
validParams
InputParameters validParams()
CoupledConvectiveHeatFluxBC::_T_infinity
std::vector< const VariableValue * > _T_infinity
Far-field temperatue fields for each component.
Definition: CoupledConvectiveHeatFluxBC.h:38
CoupledConvectiveHeatFluxBC::validParams
static InputParameters validParams()
Definition: CoupledConvectiveHeatFluxBC.C:17
CoupledConvectiveHeatFluxBC::_htc
std::vector< const VariableValue * > _htc
Convective heat transfer coefficient.
Definition: CoupledConvectiveHeatFluxBC.h:40
CoupledConvectiveHeatFluxBC::_n_components
unsigned int _n_components
The number of components.
Definition: CoupledConvectiveHeatFluxBC.h:36