Nov-10-2020, 06:23 AM
hi
this programm is the heat transfer module but in indexing i have problem this programm working on this way that i should know wher is this element that i select then i should make a Decision to how to fill it at last this array be a the system of equations and solve it.
this programm is the heat transfer module but in indexing i have problem this programm working on this way that i should know wher is this element that i select then i should make a Decision to how to fill it at last this array be a the system of equations and solve it.
import numpy as np h=500+29/2 hg=np.zeros([13,29]) def on_line(i,j): if (i==0 and j in range(1,12)) : return 'bil' elif (i==28 and j in range(1,12)): return 'bir' elif (j==12 and i in range(1,29)): return 'bid' elif (i==0 and j==12): return 'cil' elif (i==28 and j==12): return 'cir' elif (i==0 and j==0): return 'ccvl' elif (i==28 and j==0): return 'ccvr' elif (i in range(1,9) and j==0) or (i in range(20,28) and j==0): return 'bcv' elif (i in range(10,19)and j==0): return 'bcvge' elif (i==9 and j==0)or(i==19 and j==0): return 'ccvgecd' elif (i==9 and j==4 ): return 'ccdgel' elif (i==28 and j==0): return 'ccdgel' elif (i==9 and j in range(1,5)): return 'cbl' elif (j==4 and i in range(10,19)): return 'cbd' elif (i==19 and j in range(1,5)): return 'cbr' elif (i in range(10,19)and j in range(1,4)): return 'c' else: return 'bo' for i in range(29): for j in range(13): x=on_line(i,j) if x=='bil': hg[i][j]=(hg[i,j+1]+hg[i,j-1]+2*hg[i+1,j])/4 if x=='cil': hg[i][j]=hg[i][j-1]+hg[i+1][j] if x=='bir': hg[i][j]=(hg[i][j+1]+hg[i][j-1]+2*hg[i-1][j])/4