www.mooseframework.org
AnisoHeatConductionMaterial.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 
9 #include "Function.h"
10 #include "MooseMesh.h"
11 
12 #include "libmesh/quadrature.h"
13 
14 template <>
15 InputParameters
17 {
18  InputParameters params = validParams<Material>();
19 
20  params.addCoupledVar("temp", "Coupled Temperature");
21 
22  params.addParam<Real>("thermal_conductivity_x", "The thermal conductivity in the x direction");
23  params.addParam<Real>("thermal_conductivity_y", "The thermal conductivity in the y direction");
24  params.addParam<Real>("thermal_conductivity_z", "The thermal conductivity in the z direction");
25  params.addParam<PostprocessorName>("thermal_conductivity_x_pp",
26  "The thermal conductivity PP name in the x direction");
27  params.addParam<PostprocessorName>("thermal_conductivity_y_pp",
28  "The thermal conductivity PP name in the y direction");
29  params.addParam<PostprocessorName>("thermal_conductivity_z_pp",
30  "The thermal conductivity PP name in the z direction");
31 
32  params.addParam<Real>("specific_heat", "The specific heat value");
33  params.addParam<FunctionName>(
34  "specific_heat_temperature_function", "", "Specific heat as a function of temperature.");
35 
36  return params;
37 }
38 
40  : Material(parameters),
41 
42  _has_temp(isCoupled("temp")),
43  _temperature(_has_temp ? coupledValue("temp") : _zero),
44 
45  _my_thermal_conductivity_x(
46  isParamValid("thermal_conductivity_x") ? getParam<Real>("thermal_conductivity_x") : -1),
47  _my_thermal_conductivity_y(
48  isParamValid("thermal_conductivity_y") ? getParam<Real>("thermal_conductivity_y") : -1),
49  _my_thermal_conductivity_z(
50  isParamValid("thermal_conductivity_z") ? getParam<Real>("thermal_conductivity_z") : -1),
51 
52  _thermal_conductivity_x_pp(isParamValid("thermal_conductivity_x_pp")
53  ? &getPostprocessorValue("thermal_conductivity_x_pp")
54  : NULL),
55  _thermal_conductivity_y_pp(isParamValid("thermal_conductivity_y_pp")
56  ? &getPostprocessorValue("thermal_conductivity_y_pp")
57  : NULL),
58  _thermal_conductivity_z_pp(isParamValid("thermal_conductivity_z_pp")
59  ? &getPostprocessorValue("thermal_conductivity_z_pp")
60  : NULL),
61 
62  _my_specific_heat(isParamValid("specific_heat") ? getParam<Real>("specific_heat") : 0),
63 
64  _thermal_conductivity_x(&declareProperty<Real>("thermal_conductivity_x")),
65  _thermal_conductivity_x_dT(&declareProperty<Real>("thermal_conductivity_x_dT")),
66  _thermal_conductivity_y(isParamValid("thermal_conductivity_y") ||
67  isParamValid("thermal_conductivity_y_pp")
68  ? &declareProperty<Real>("thermal_conductivity_y")
69  : NULL),
70  _thermal_conductivity_y_dT(
71  _thermal_conductivity_y ? &declareProperty<Real>("thermal_conductivity_y_dT") : NULL),
72  _thermal_conductivity_z(isParamValid("thermal_conductivity_z") ||
73  isParamValid("thermal_conductivity_z_pp")
74  ? &declareProperty<Real>("thermal_conductivity_z")
75  : NULL),
76  _thermal_conductivity_z_dT(
77  _thermal_conductivity_z ? &declareProperty<Real>("thermal_conductivity_z_dT") : NULL),
78 
79  _specific_heat(declareProperty<Real>("specific_heat")),
80  _specific_heat_temperature_function(
81  getParam<FunctionName>("specific_heat_temperature_function") != ""
82  ? &getFunction("specific_heat_temperature_function")
83  : NULL)
84 {
85  bool k_x = isParamValid("thermal_conductivity_x") || (NULL != _thermal_conductivity_x_pp);
86  bool k_y = isParamValid("thermal_conductivity_y") || (NULL != _thermal_conductivity_y_pp);
87  bool k_z = isParamValid("thermal_conductivity_z") || (NULL != _thermal_conductivity_z_pp);
88 
89  if (!k_x || (_subproblem.mesh().dimension() > 1 && !k_y) ||
90  (_subproblem.mesh().dimension() > 2 && !k_z))
91  {
92  mooseError("Incomplete set of orthotropic thermal conductivity parameters");
93  }
95  {
96  mooseError("Must couple with temperature if using specific heat function");
97  }
98  if (isParamValid("specific_heat") && _specific_heat_temperature_function)
99  {
100  mooseError("Cannot define both specific heat and specific heat temperature function");
101  }
102 
103  k_x = isParamValid("thermal_conductivity_x") && (NULL != _thermal_conductivity_x_pp);
104  k_y = isParamValid("thermal_conductivity_y") && (NULL != _thermal_conductivity_y_pp);
105  k_z = isParamValid("thermal_conductivity_z") && (NULL != _thermal_conductivity_z_pp);
106  if (k_x || k_y || k_z)
107  {
108  mooseError("Cannot define thermal conductivity value and Postprocessor");
109  }
110 }
111 
112 void
114 {
115  for (unsigned int qp(0); qp < _qrule->n_points(); ++qp)
116  {
117  (*_thermal_conductivity_x)[qp] =
119  (*_thermal_conductivity_x_dT)[qp] = 0;
121  {
122  (*_thermal_conductivity_y)[qp] =
124  (*_thermal_conductivity_y_dT)[qp] = 0;
125  }
127  {
128  (*_thermal_conductivity_z)[qp] =
130  (*_thermal_conductivity_z_dT)[qp] = 0;
131  }
132 
134  {
135  Point p;
137  }
138  else
139  {
141  }
142  }
143 }
const PostprocessorValue *const _thermal_conductivity_z_pp
MaterialProperty< Real > *const _thermal_conductivity_z
AnisoHeatConductionMaterial(const InputParameters &parameters)
const PostprocessorValue *const _thermal_conductivity_y_pp
MaterialProperty< Real > & _specific_heat
const PostprocessorValue *const _thermal_conductivity_x_pp
InputParameters validParams< AnisoHeatConductionMaterial >()
MaterialProperty< Real > *const _thermal_conductivity_y