www.mooseframework.org
ThermalConductivity.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #include "ThermalConductivity.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<SideAverageValue>();
14  params.addRequiredParam<Real>("dx", "Length between sides of sample in length_scale");
15  params.addRequiredParam<PostprocessorName>(
16  "flux", "Heat flux out of 'cold' boundary in solution units, should always be positive");
17  params.addRequiredParam<PostprocessorName>("T_hot", "Temperature on 'hot' boundary in K");
18  params.addParam<Real>("length_scale", 1e-8, "lengthscale of the solution, default is 1e-8");
19  params.addParam<Real>("k0", 0.0, "Initial value of the thermal conductivity");
20  return params;
21 }
22 
23 ThermalConductivity::ThermalConductivity(const InputParameters & parameters)
24  : SideAverageValue(parameters),
25  _dx(getParam<Real>("dx")),
26  _flux(getPostprocessorValue("flux")),
27  _T_hot(getPostprocessorValue("T_hot")),
28  _length_scale(getParam<Real>("length_scale")),
29  _k0(getParam<Real>("k0")),
30  _step_zero(declareRestartableData<bool>("step_zero", true))
31 {
32 }
33 
34 Real
36 {
37  const Real T_cold = SideAverageValue::getValue();
38  Real Th_cond = 0.0;
39  if (_t_step >= 1)
40  _step_zero = false;
41 
42  // Calculate effective thermal conductivity in W/(length_scale-K)
43  if (std::abs(_T_hot - T_cold) > 1.0e-20)
44  Th_cond = std::abs(_flux) * _dx / std::abs(_T_hot - T_cold);
45 
46  if (_step_zero)
47  return _k0;
48  else
49  return Th_cond / _length_scale; // In W/(m-K)
50 }
InputParameters validParams< ThermalConductivity >()
const PostprocessorValue & _T_hot
bool & _step_zero
True if this is the zeroth timestep (timestep < 1).
ThermalConductivity(const InputParameters &parameters)
const PostprocessorValue & _flux