Buckets:
| import sympy as sp | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| def heat_conduction(T_0,T_s,k,dt,N=100,theta=0): | |
| T=np.zeros(N) | |
| T[0]=T_0 | |
| for i in range(1,N): | |
| T[i]=(1-(1-theta)*dt*k)*T[i-1]/(1+theta*dt*k)-k*dt*T_s/(1+theta*dt*k) | |
| return T | |
| T_0=100 | |
| T_s=20 | |
| k=0.1 | |
| dt=0.1e-1 | |
| N=1000 | |
| theta=[0,0.5,1,1.2] | |
| T=[[] for i in range(len(theta))] | |
| t=np.linspace(0,N*dt,N) | |
| T_real=[(T_0-T_s)*np.exp(-k*i*dt)+T_s for i in range(N) ] | |
| # print(T_real) | |
| for i in range(len(theta)): | |
| T[i]=heat_conduction(T_0,T_s,k,dt,N=N,theta=theta[i]) | |
| # print(T[-1]) | |
| plt.plot(t,T[0]) | |
| plt.plot(t,T[1]) | |
| plt.plot(t,T[2]) | |
| plt.plot(t,T[3]) | |
| plt.plot(t,T_real) | |
| plt.legend(["T_0","T_0.5","T_1","T_1.2","T_real"]) | |
| plt.savefig("newton_heat_conduction.png") | |
Xet Storage Details
- Size:
- 759 Bytes
- Xet hash:
- 6ed8518f29b7d031750dd69f67b48303428ba5df251c57b4f4adf66b2fc9e8bd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.