www.mooseframework.org
ConvectiveFluxFunction.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 
10 #include "ConvectiveFluxFunction.h"
11 
12 #include "Function.h"
13 
14 registerMooseObject("HeatConductionApp", ConvectiveFluxFunction);
15 
17 
18 InputParameters
20 {
21  InputParameters params = IntegratedBC::validParams();
22  params.addRequiredParam<FunctionName>("T_infinity", "Function describing far-field temperature");
23  params.addRequiredParam<FunctionName>("coefficient",
24  "Function describing heat transfer coefficient");
25  MooseEnum coef_func_type("TIME_AND_POSITION TEMPERATURE", "TIME_AND_POSITION");
26  params.addParam<MooseEnum>(
27  "coefficient_function_type",
28  coef_func_type,
29  "Type of function for heat transfer coefficient provided in 'coefficient' parameter");
30  params.addDeprecatedParam<FunctionName>(
31  "coefficient_function",
32  "Heat transfer coefficient function",
33  "'coefficient' should be used instead. 'coefficient_function will be removed on March 1, "
34  "2020.");
35  params.addClassDescription(
36  "Determines boundary value by fluid heat transfer coefficient and far-field temperature");
37 
38  return params;
39 }
40 
41 ConvectiveFluxFunction::ConvectiveFluxFunction(const InputParameters & parameters)
42  : IntegratedBC(parameters),
43  _T_infinity(getFunction("T_infinity")),
44  _coefficient(getFunction("coefficient")),
45  _coef_func_type(getParam<MooseEnum>("coefficient_function_type").getEnum<CoefFuncType>()),
46  _coef_func(isParamValid("coefficient_function") ? &getFunction("coefficient_function") : NULL)
47 {
49  mooseError("Deprecated 'coefficient_function' parameter cannot be used with "
50  "'coefficient_function_type=TEMPERATURE'");
51 }
52 
53 Real
55 {
56  Real coef;
58  {
59  coef = _coefficient.value(_t, _q_point[_qp]);
60  if (_coef_func) // Deprecated behavior
61  coef *= _coef_func->value(_t, _q_point[_qp]);
62  }
63  else
64  coef = _coefficient.value(_u[_qp], Point());
65 
66  return _test[_i][_qp] * coef * (_u[_qp] - _T_infinity.value(_t, _q_point[_qp]));
67 }
68 
69 Real
71 {
73  {
74  Real coef = _coefficient.value(_t, _q_point[_qp]);
75  if (_coef_func) // Deprecated behavior
76  coef *= _coef_func->value(_t, _q_point[_qp]);
77  return _test[_i][_qp] * coef * _phi[_j][_qp];
78  }
79  else
80  {
81  const Real coef = _coefficient.value(_u[_qp], Point());
82  const Real dcoef_dT = _coefficient.timeDerivative(_u[_qp], Point());
83  return _test[_i][_qp] * (coef + (_u[_qp] - _T_infinity.value(_t, _q_point[_qp])) * dcoef_dT) *
84  _phi[_j][_qp];
85  }
86 }
ConvectiveFluxFunction::computeQpResidual
virtual Real computeQpResidual() override
Definition: ConvectiveFluxFunction.C:54
defineLegacyParams
defineLegacyParams(ConvectiveFluxFunction)
ConvectiveFluxFunction::CoefFuncType
CoefFuncType
Enum used to define the type of function used for the heat transfer coefficient.
Definition: ConvectiveFluxFunction.h:33
ConvectiveFluxFunction::ConvectiveFluxFunction
ConvectiveFluxFunction(const InputParameters &parameters)
Definition: ConvectiveFluxFunction.C:41
ConvectiveFluxFunction.h
ConvectiveFluxFunction
Definition: ConvectiveFluxFunction.h:14
ConvectiveFluxFunction::_coefficient
const Function & _coefficient
Heat transfer coefficient.
Definition: ConvectiveFluxFunction.h:30
ConvectiveFluxFunction::_T_infinity
const Function & _T_infinity
Far-field temperature.
Definition: ConvectiveFluxFunction.h:27
ConvectiveFluxFunction::CoefFuncType::TIME_AND_POSITION
validParams
InputParameters validParams()
ConvectiveFluxFunction::validParams
static InputParameters validParams()
Definition: ConvectiveFluxFunction.C:19
ConvectiveFluxFunction::_coef_func
const Function *const _coef_func
Heat transfer coefficient function (Deprecated – being replaced by _coefficient)
Definition: ConvectiveFluxFunction.h:43
registerMooseObject
registerMooseObject("HeatConductionApp", ConvectiveFluxFunction)
ConvectiveFluxFunction::_coef_func_type
const CoefFuncType _coef_func_type
Type of function used for the heat transfer coefficient.
Definition: ConvectiveFluxFunction.h:40
ConvectiveFluxFunction::CoefFuncType::TEMPERATURE
ConvectiveFluxFunction::computeQpJacobian
virtual Real computeQpJacobian() override
Definition: ConvectiveFluxFunction.C:70