#include <codecogs/engineering/heat_transfer/conduction/nhm_sphere.h>
using namespace Engineering::Heat_Transfer::Conduction;
| std::vector<double> | nhm_sphere (int n, double t1, double t2, double *d, double *lambda) Computes the temperatures at contact surfaces between the layers of a spherical non-homogeneous wall. |
| std::vector<double>nhm_sphere( | int | n | |
| double | t1 | ||
| double | t2 | ||
| double* | d | ||
| double* | lambda | ) |
![\displaystyle Q = 2\pi (t_1 - t_2) \left[ \sum_{i=1}^n \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}
\displaystyle Q = 2\pi (t_1 - t_2) \left[ \sum_{i=1}^n \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}](/latexrender/sites/unknown/7871b5923646fe8465cb033d8d0897c3.gif)
![\displaystyle Q_k = 2 \pi (t_1 - ts_k)
\left[ \sum_{i=1}^k \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}.
\displaystyle Q_k = 2 \pi (t_1 - ts_k)
\left[ \sum_{i=1}^k \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}.](/latexrender/sites/unknown/744f68b31d8e952204deb0a351510097.gif)
![\displaystyle ts_k = t_1 - \frac{Q}{2 \pi} \left[ \sum_{i=1}^k \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}
\qquad i = \overline{1, n-1}.
\displaystyle ts_k = t_1 - \frac{Q}{2 \pi} \left[ \sum_{i=1}^k \frac{1}{\lambda_i}
\left( \frac{1}{d_{i-1}} - \frac{1}{d_i} \right) \right]^{-1}
\qquad i = \overline{1, n-1}.](/latexrender/sites/unknown/0a1e6012a32cc732c0a34f508c16526d.gif)

#include <codecogs/engineering/heat_transfer/conduction/nhm_sphere.h> #include <stdio.h> int main() { // input data int n = 4; double t1 = 75.0, t2 = 20.0, d[5] = {0.1, 0.15, 0.2, 0.25, 0.35}, lambda[4] = {0.75, 0.95, 1.2, 1.0}; // display the various input data printf("Input values:\n\n"); printf(" n = %d\nt1 = %.2lf\nt2 = %.2lf\n\n", n, t1, t2); printf("diameters:\n("); int i; for (i = 0; i < n; i++) printf("%.2lf, ", d[i]); printf("%.2lf)\n\n", d[n]); printf("lambda:\n("); for (i = 0; i < n - 1; i++) printf("%.2lf, ", lambda[i]); printf("%.2lf)\n\n", lambda[n - 1]); // compute the temperatures at the contact surfaces between all layers std::vector<double> result = Engineering::Heat_Transfer::Conduction::nhm_sphere (4, t1, t2, d, lambda); // display the results printf("\nThe temperatures at contact surfaces between layers are:\n\n"); printf("("); for (i = 0; i < result.size() - 1; i++) printf("%.5lf, ", result[i]); printf("%.5lf)\n\n", result[result.size() - 1]); return 0; }
Input values: n = 4 t1 = 75.00 t2 = 20.00 diameters: (0.10, 0.15, 0.20, 0.25, 0.35) lambda: (0.75, 0.95, 1.20, 1.00) The temperatures at contact surfaces between layers are: (45.09862, 33.29544, 27.68893)
| n | the number of layers |
| t1 | the temperature of the heat flow at the entry surface (degrees Celsius) |
| t2 | the temperature of the heat flow at the exit surface (degrees Celsius) |
| d | an array with the diameters of the layers (meters) |
| lambda | an array with the thermal conductivities of the layers (Watts per meter Celsius) |