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 
18 {
20  params.addClassDescription(
21  "Postprocessor for asymptotic expansion homogenization for thermal conductivity");
22  params.addRequiredCoupledVar(
23  "chi", "The characteristic functions used for homogenization of the thermal conductivity.");
24  params.addRequiredParam<unsigned int>(
25  "row",
26  "The row index of the homogenized thermal conductivity tensor entry computed by this "
27  "postprocessor.");
28  params.addRequiredParam<unsigned int>(
29  "col",
30  "The column index of the homogenized thermal conductivity tensor entry computed by this "
31  "postprocessor.");
32 
33  params.addParam<Real>("scale_factor", 1, "Scale factor");
34  params.addParam<MaterialPropertyName>(
35  "diffusion_coefficient", "thermal_conductivity", "Property name of the diffusivity");
36  params.addParam<bool>(
37  "is_tensor", false, "True if the material property in diffusion_coefficient is a tensor");
38  return params;
39 }
40 
42  : ElementIntegralPostprocessor(parameters),
43  _row(getParam<unsigned int>("row")),
44  _col(getParam<unsigned int>("col")),
45  _scale(getParam<Real>("scale_factor")),
46  _dim(_mesh.dimension()),
47  _diffusion_coefficient(!getParam<bool>("is_tensor")
48  ? &getMaterialProperty<Real>("diffusion_coefficient")
49  : nullptr),
50  _tensor_diffusion_coefficient(getParam<bool>("is_tensor")
51  ? &getMaterialProperty<RankTwoTensor>("diffusion_coefficient")
52  : nullptr)
53 {
54  if (_row >= _dim)
55  paramError("row", "Must be smaller than mesh dimension (0, 1, 2 for 1D, 2D, 3D)");
56 
57  if (_col >= _dim)
58  paramError("col", "Must be smaller than mesh dimension (0, 1, 2 for 1D, 2D, 3D)");
59 
60  if (coupledComponents("chi") != _dim)
61  paramError("chi", "The number of entries must be identical to the mesh dimension.");
62 
63  _grad_chi.resize(_dim);
64  for (unsigned int j = 0; j < _dim; ++j)
65  _grad_chi[j] = &coupledGradient("chi", j);
66 }
67 
68 void
70 {
71  _integral_value = 0.0;
72  _volume = 0.0;
73 }
74 
75 void
77 {
80 }
81 
82 Real
84 {
85  return _integral_value / _volume;
86 }
87 
88 void
90 {
93 }
94 
95 void
97 {
98  const auto & pps = static_cast<const HomogenizedThermalConductivity &>(y);
99 
100  _integral_value += pps._integral_value;
101  _volume += pps._volume;
102 }
103 
104 Real
106 {
107  // the _row-th row of the thermal conductivity tensor
108  RealVectorValue k_row;
110  k_row(_row) = (*_diffusion_coefficient)[_qp];
111  else
112  for (unsigned int j = 0; j < _dim; ++j)
113  k_row(j) = (*_tensor_diffusion_coefficient)[_qp](_row, j);
114 
115  // initialize the dchi/dx tensor, but we only use _col-th column
116  RealVectorValue M_col;
117  M_col(_col) = 1.0;
118  for (unsigned int i = 0; i < _dim; ++i)
119  M_col(i) += (*_grad_chi[_col])[_qp](i);
120 
121  return _scale * k_row * M_col;
122 }
Homogenization of Temperature-Dependent Thermal Conductivity in Composite Materials, Journal of Thermophysics and Heat Transfer, Vol.
const MaterialProperty< Real > * _diffusion_coefficient
heterogeneous diffusion coefficient as scalar and tensor
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
Real _integral_value
the integral value that is being accumulated
const std::vector< double > y
Real _volume
volume of the integration domain
std::vector< const VariableGradient * > _grad_chi
the gradients of the characteristic functions usually denoted chi in the literature ...
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
const Real _scale
a scale factor multiplied to the result
registerMooseObject("HeatTransferApp", HomogenizedThermalConductivity)
static InputParameters validParams()
virtual void threadJoin(const UserObject &y) override
void paramError(const std::string &param, Args... args) const
const unsigned int _dim
dimension of the mesh
const unsigned int _row
the row index of the homogenized thermal conductivity tensor that is returned
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
HomogenizedThermalConductivity(const InputParameters &parameters)
unsigned int coupledComponents(const std::string &var_name) const
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual Real getValue() const override
virtual Real computeIntegral()
void addClassDescription(const std::string &doc_string)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
const unsigned int _col
the column index of the homogenized thermal conductivity tensor that is returned
void ErrorVector unsigned int