www.mooseframework.org
HomogenizedThermalConductivity.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 /****************************************************************/
8 #include "SubProblem.h"
9 #include "MooseMesh.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<ElementAverageValue>();
16  params.addRequiredCoupledVar("temp_x", "solution in x");
17  params.addCoupledVar("temp_y", "solution in y");
18  params.addCoupledVar("temp_z", "solution in z");
19  params.addRequiredRangeCheckedParam<unsigned int>(
20  "component",
21  "component < 3",
22  "An integer corresponding to the direction this pp acts in (0 for x, 1 for y, 2 for z)");
23  params.addParam<Real>("scale_factor", 1, "Scale factor");
24  params.addParam<MaterialPropertyName>(
25  "diffusion_coefficient",
26  "thermal_conductivity",
27  "Property name of the diffusivity (Default: thermal_conductivity)");
28  return params;
29 }
30 
32  : ElementAverageValue(parameters),
33  _grad_temp_x(coupledGradient("temp_x")),
34  _grad_temp_y(_subproblem.mesh().dimension() >= 2 ? coupledGradient("temp_y") : _grad_zero),
35  _grad_temp_z(_subproblem.mesh().dimension() == 3 ? coupledGradient("temp_z") : _grad_zero),
36  _component(getParam<unsigned int>("component")),
37  _diffusion_coefficient(getMaterialProperty<Real>("diffusion_coefficient")),
38  _scale(getParam<Real>("scale_factor"))
39 {
40 }
41 
42 void
44 {
45  _integral_value = 0.0;
46  _volume = 0.0;
47 }
48 
49 void
51 {
52  _integral_value += computeIntegral();
53  _volume += _current_elem_volume;
54 }
55 
56 Real
58 {
59  gatherSum(_integral_value);
60  gatherSum(_volume);
61 
62  return (_integral_value / _volume);
63 }
64 
65 void
67 {
68  const HomogenizedThermalConductivity & pps =
69  dynamic_cast<const HomogenizedThermalConductivity &>(y);
70 
72  _volume += pps._volume;
73 }
74 
75 Real
77 {
78  Real value = 1.0;
79 
80  switch (_component)
81  {
82  case 0:
83  value += _grad_temp_x[_qp](0);
84  break;
85 
86  case 1:
87  value += _grad_temp_y[_qp](1);
88  break;
89 
90  case 2:
91  value += _grad_temp_z[_qp](2);
92  break;
93 
94  default:
95  mooseError("Internal error.");
96  }
97 
98  return _scale * _diffusion_coefficient[_qp] * value;
99 }
Homogenization of Temperature-Dependent Thermal Conductivity in Composite Materials, Journal of Thermophysics and Heat Transfer, Vol.
const MaterialProperty< Real > & _diffusion_coefficient
InputParameters validParams< HomogenizedThermalConductivity >()
HomogenizedThermalConductivity(const InputParameters &parameters)
virtual void threadJoin(const UserObject &y)