exs_flw_temp1

Purpose:

Analysis of one-dimensional heat flow.

Description:

Consider a wall built up of concrete and thermal insulation. The outdoor temperature is \(-17°\text{C}\) and the temperature inside is \(20°\text{C}\). At the inside of the thermal insulation there is a heat source yielding \(10\) W/m².

_images/exs2_1.svg
_images/exs2_2.svg

The wall is subdivided into five elements and the one-dimensional spring (analogy) element spring1e is used. Equivalent spring stiffnesses are \(k_i=\lambda A/L\) for thermal conductivity and \(k_i=A/R\) for thermal surface resistance. Corresponding spring stiffnesses per m² of the wall are:

\(k_1 =\)

\(1/0.04\)

\(=\)

\(25.0\)

W/K

\(k_2 =\)

\(1.7/0.070\)

\(=\)

\(24.3\)

W/K

\(k_3 =\)

\(0.040/0.100\)

\(=\)

\(0.4\)

W/K

\(k_4 =\)

\(1.7/0.100\)

\(=\)

\(17.0\)

W/K

\(k_5 =\)

\(1/0.13\)

\(=\)

\(7.7\)

W/K

Example:

The computation is initialized by importing CALFEM and NumPy. A global system matrix K and a heat flow vector f are defined. The heat source inside the wall is considered by setting \(f_4=10\). The element matrices Ke are computed using cfc.spring1e, and the function cfc.assem assembles the global stiffness matrix. The system of equations is solved using cfc.solveq with boundary conditions. The prescribed temperatures are \(T_1=-17°\text{C}\) and \(T_6=20°\text{C}\):

import numpy as np
import calfem.core as cfc
import calfem.utils as cfu

# ----- Topology -------------------------------------------------

edof = np.array([
    [1, 2],
    [2, 3],
    [3, 4],
    [4, 5],
    [5, 6]
])

# ----- Stiffness matrix K and load vector f ---------------------

K = np.array(np.zeros((6, 6)))
f = np.array(np.zeros((6, 1)))
f[3] = 10.0

# ----- Element stiffness and element load matrices  -------------

ep1 = 25
ep2 = 24.3
ep3 = 0.4
ep4 = 17
ep5 = 7.7

Ke1 = cfc.spring1e(ep1)
Ke2 = cfc.spring1e(ep2)
Ke3 = cfc.spring1e(ep3)
Ke4 = cfc.spring1e(ep4)
Ke5 = cfc.spring1e(ep5)

# ----- Assemble Ke into K ---------------------------------------

cfc.assem(edof[0, :], K, Ke1)
cfc.assem(edof[1, :], K, Ke2)
cfc.assem(edof[2, :], K, Ke3)
cfc.assem(edof[3, :], K, Ke4)
cfc.assem(edof[4, :], K, Ke5)

# ----- Solve the system of equations ----------------------------

bc = np.array([1, 6])
bcVal = np.array([-17, 20])
a, r = cfc.solveq(K, f, bc, bcVal)

cfu.disp_h2("Temperatures a:")
cfu.disp_array(a, tablefmt="plain")

cfu.disp_h2("Reaction flows r:")
cfu.disp_array(r, tablefmt="plain")

The temperature values \(a_i\) at the node points are given in the vector a and the boundary heat flows in the vector r.

After solving the system of equations, the heat flow through each element is computed using cfc.extract_ed and cfc.spring1s:

ed1 = cfc.extract_ed(edof[0, :], a)
ed2 = cfc.extract_ed(edof[1, :], a)
ed3 = cfc.extract_ed(edof[2, :], a)
ed4 = cfc.extract_ed(edof[3, :], a)
ed5 = cfc.extract_ed(edof[4, :], a)

q1 = cfc.spring1s(ep1, ed1)
q2 = cfc.spring1s(ep2, ed2)
q3 = cfc.spring1s(ep3, ed3)
q4 = cfc.spring1s(ep4, ed4)
q5 = cfc.spring1s(ep5, ed5)

cfu.disp_h2("Element flows:")

print("q1 = ")
print(q1)
print("q2 = ")
print(q2)
print("q3 = ")
print(q3)
print("q4 = ")
print(q4)
print("q5 = ")
print(q5)

The heat flow through the wall is \(q=14.0\) W/m² in the part of the wall to the left of the heat source (elements 1-3), and \(q=4.0\) W/m² in the part to the right of the heat source (elements 4-5). This demonstrates how the internal heat source affects the heat flow distribution through the wall.