https://mooseframework.inl.gov
Loading...
Searching...
No Matches
HomogenizedThermalConductivity.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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{
21 "Postprocessor for asymptotic expansion homogenization for thermal conductivity");
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
68void
74
75void
81
82Real
87
88void
94
95void
97{
98 const auto & pps = static_cast<const HomogenizedThermalConductivity &>(y);
99
101 _volume += pps._volume;
102}
103
104Real
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}
const std::vector< double > y
registerMooseObject("HeatTransferApp", HomogenizedThermalConductivity)
void ErrorVector unsigned int
virtual const VariableGradient & coupledGradient(const std::string &var_name, unsigned int comp=0) const
unsigned int coupledComponents(const std::string &var_name) const
static InputParameters validParams()
virtual Real computeIntegral()
Homogenization of Temperature-Dependent Thermal Conductivity in Composite Materials,...
std::vector< const VariableGradient * > _grad_chi
the gradients of the characteristic functions usually denoted chi in the literature
Real _volume
volume of the integration domain
const Real _scale
a scale factor multiplied to the result
virtual void threadJoin(const UserObject &y) override
const unsigned int _row
the row index of the homogenized thermal conductivity tensor that is returned
const unsigned int _dim
dimension of the mesh
HomogenizedThermalConductivity(const InputParameters &parameters)
const MaterialProperty< Real > * _diffusion_coefficient
heterogeneous diffusion coefficient as scalar and tensor
Real _integral_value
the integral value that is being accumulated
const unsigned int _col
the column index of the homogenized thermal conductivity tensor that is returned
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void paramError(const std::string &param, Args... args) const