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