问题描述
对于一维数组: T [1,2] =(T [0,1] + T [2,3])/ 2 T [2,3] =(T [1,2] + T [3,4])/ 2 ...
然后我解决这个方程组
P.S:我正在尝试创建一个2D矩阵来模拟和解决矩形板上的热扩散。
所以基本上我使用的是Central Eular方法,我需要构建网格所有点的方程组,显示它们,然后求解。我当然有边界条件和值。
这大约是我过去在Maple中执行的代码逻辑:
L = 15
H = 15
dx = 3
dy = 3
ndx = int(L/dx)
ndy = int(H/dy)
i_max = ndx-1
j_max = ndy-1
Tb = 10
Tl = 40
Tr = 60
Tt = 90
N = (ndx-1)*(ndy-1)
# T = np.ones(([ndx,ndy]))
T = np.empty(ndx,ndy,dtype=np)
# boundary conditions assignement:
T[:,0] = Tl
T[:,-1] = Tr
T[0,:] = Tt
T[-1,:] = Tb
T[0,0] = (Tt + Tl)/2
T[0,-1] = (Tt + Tr)/2
T[-1,0] = (Tb + Tl)/2
T[-1,-1] = (Tb + Tr)/2
# Equations:
for i in range(1,i_max):
for j in range(1,j_max):
T[i,j] = (T[i-1,j] + T[i+1,j] + T[i,j-1] + T[i,j+1])/(-4)
print(T[i,j])
# Solution:
for i in range(1,j_max):
s = np.solve(T[i,j],[i,j])
print(s)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)