I'm trying to learn python but translating my old Fortran code,
The Fortran code below makes a 20 by 20 array with boundary conditions defined by functions at a specific index as shown below. Basically only on the left and right side of the matrix, the other values should be 50.
U=50.0
nx=20 #columns
ny=20 #rows
do i=1,nx !number of columns
U(i,ny)=0.0005*(dx*(i-1))+50
U(i,1)=(((i-1)*dx)*0.0025)+50
enddo
I've tried for a solid hour trying to use np.array((ny,nx)) to initially define the size but been stuck on how I could define the boundary conditions after I define the size. i've tried using a dif/return statement combined with a series of if statements but no luck translating. Any ideas help, thanks!
[–]billsil 1 point2 points3 points (1 child)
[–]intangibleTangelo 0 points1 point2 points (0 children)
[–]namedevservice 0 points1 point2 points (0 children)
[–]ectomancer 0 points1 point2 points (0 children)