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