<jupyter_start><jupyter_text>Fourier equation, stationary case: Composite wall with different isolating layers, dT, with heat production (heat changing material)<jupyter_code>import numpy as np
print('numpy: '+np.version.full_version)
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D 
import matplotlib.animation as animation
import matplotlib
print('matplotlib: '+matplotlib.__version__)
from IPython.display import HTML<jupyter_output>numpy: 1.19.2
matplotlib: 3.3.2<jupyter_text>$T_\infty = 20^o C$, and $h = 10 W/[m^2.K]$. Consider a composite wall composed of 3 sections:$A$: $k_A = 0.24 W/[m.K]$, $e_A = 20 mm$$B$: $k_B = 0.13 W/[m.K]$, $e_B = 13 mm$$C$: $k_C = 0.5 W/[m.K]$, $e_C = 20 mm$The section $A$ has heat generation rate $Q W/m^3$. This means that heat flux through $A$, is $q_A = Q. e_A$. Taking contact resistance to be $R_tc = 0 m^2 K/W$. Also, let the left side of section $A$ to be insulated.$q_A = \frac{T_C - T_\infty}{1/h} = \frac{T_{BC} - T_C}{e_C/k_C} = \frac{T_{AB} - T_{BC}}{e_B/k_B}$.For section $A$, $\frac{d^2 T}{dx^2} = - \frac{Q}{k_A}$ with boundary conditions: $\frac{dT}{dx}=0$, and $T(e_A) = T_{AB}$<jupyter_code>tinf = 293 #K
h = 10 #W/m2K
kA = 0.24
kB = 0.13
kC = 0.5
eA_list = np.arange(1,21,1)
eB_list = np.arange(1,14,1)
eC_list = np.arange(1,21,1)
Q_list = np.arange(4,6.5,0.5)
q_list = [q*eA_list[len(eA_list)-1] for q in Q_list]
Tc_list = [q/h + tinf for q in q_list]
Tbc_list = [tc*(eC_list[len(eC_list)-1]*h/kC + 1)+tinf*eC_list[len(eC_list)-1]*h/kC for tc in Tc_list]
Tab_list = [tbc*(eB_list[len(eB_list)-1]*kC/(kB*eC_list[len(eC_list)-1]) + 1)+tc*eB_list[len(eB_list)-1]*kC/(kB*eC_list[len(eC_list)-1]) for (tbc,tc) in zip(Tbc_list,Tc_list)]
Ta_list = [q*(x*x - eA_list[len(eA_list)-1]*eA_list[len(eA_list)-1])/(2*eA_list[len(eA_list)-1])+tab for (q,tab) in zip(Q_list,Tab_list) for x in eA_list]
Tb_list = [(tbc-tab)*x/eB_list[len(eB_list)-1] + tab for (tbc,tab) in zip(Tbc_list, Tab_list) for x in eB_list]
Tc2_list = [(tc-tbc)*x/eC_list[len(eC_list)-1] + tbc for (tc,tbc) in zip(Tc_list, Tbc_list) for x in eC_list]
Tfin_list = Ta_list + Tb_list + Tc2_list
efin_list = np.arange(1,len(eA_list)+len(eB_list)+len(eC_list),1)
Qfin_list = [4]*len(eA_list)+[4.5]*len(eA_list)+[5]*len(eA_list)+[5.5]*len(eA_list)+[6]*len(eA_list) + [4]*len(eB_list)+[4.5]*len(eB_list)+[5]*len(eB_list)+[5.5]*len(eB_list)+[6]*len(eB_list)+[4]*len(eC_list)+[4.5]*len(eC_list)+[5]*len(eC_list)+[5.5]*len(eC_list)+[6]*len(eC_list)
print(len(Qfin_list), len(Tfin_list), len(efin_list))
print(len(Q_list),len(q_list),len(Tc_list), len(Tbc_list), len(Tab_list), len(Ta_list), len(Tb_list), len(Tc2_list))
N = 150 # Meshsize
fps = 10 # frame per sec
frn = 50 # frame number of the animation

x = np.linspace(-4,4,N+1)
x, y = np.meshgrid(x, x)
zarray = np.zeros((N+1, N+1, frn))

f = lambda x,y,sig : 1/np.sqrt(sig)*np.exp(-(x**2+y**2)/sig**2)

for i in range(frn):
    zarray[:,:,i] = f(x,y,1.5+np.sin(i*2*np.pi/frn))
def update_plot(frame_number, zarray, plot):
    plot[0].remove()
    plot[0] = ax.plot_surface(x, y, zarray[:,:,frame_number], cmap="magma")

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')

plot = [ax.plot_surface(x, y, zarray[:,:,0], color='0.75', rstride=1, cstride=1)]
ax.set_zlim(0,1.1)
ani = animation.FuncAnimation(fig, update_plot, frn, fargs=(zarray, plot), interval=1000/fps)
fn = 'plot_surface_animation_funcanimation'
HTML(ani.to_html5_video())
#with open("myvideo.html", "w") as f:
#    print(ani.to_html5_video(), file=f)

#ani.save(fn+'.gif',writer='imagemagick',fps=fps)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20684855233853006, 'fraction_numerical': 0.04120267260579064, 'mean_word_length': 6.031311154598826, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '159698', 'license': 'MIT', 'n_tokens_mistral': 1782, 'n_tokens_neox': 1706, 'n_words': 309, 'path': 'Ch3_FourierStationaryComposite.ipynb', 'repo_name': 'agrricha/agrricha.github.io', 'size': '3592'}