예제 #1
0
# initial conditions
# cx = 30
# cy = 25
for i in range(0, Nx + 1):
    for j in range(0, Ny + 1):
        T[i, j] = 25  # +0.2*np.random.random()
        V[i, j] = 0.0  # +0.2*np.random.random()
        W[i, j] = 0.4061 + 0.1 * np.random.random()
        # if(np.abs(i-cx)+(j-cy)**2 < 4):
        #    W[i,j] = 0
        # else:
        #    W[i,j]=0.4061+0.1*np.random.random()
        # T1[0,i]=T[i]
        # V1[0,i]=V[i]
        # W1[0,i]=W[i]
lsys = 1 - lsystem.lin() / 255
W *= lsys


def updatefig():
    global T, V, W, m
    m += 1

    T_new = Tnew(T, V, W, Nx, Ny, dt, dx, dy, theta1, theta2)

    # b = T_new.reshape((Nx+1,Ny+1))

    V_temp, W_temp, V_s, P = correction(T_new, V, W, Nx, Ny)
    T_new = T_new.reshape((Nx + 1, Ny + 1))
    print "T:", T_new[Nx / 2]
예제 #2
0
파일: mass.py 프로젝트: rbaravalle/Pysys
dx2=dx**2 # To save CPU cycles, we'll compute Delta x^2
dy2=dy**2 # and Delta y^2 only once and store them.
a = 4

tinit = toKelvin(27) # Zhang&Datta
tfactor = 1

# For stability, this is the largest interval possible
# for the size of the time-step:
dt = dx2*dy2/( 2*a*(dx2+dy2) )#*16
Dt = 0.5

dt = 0.1
# Start u and ui off as zero matrices:
wi = np.array(lsystem.lin()[0:nx,0:ny]).astype(np.float32)  # (255)? cuanto es el valor original de la masa?

wi = wi/255.0
#wi = (np.max(wi)-wi)*0.001 + 0.1

#print  

#exit()

print "MAX W: ",np.max(wi)
print "MIN W: ", np.min(wi)

wi.flags.writeable = True
#print wi.sum()
#print 'Total moisture content (W): {0:.16f}'.format(np.float64(wi.sum()))
예제 #3
0
파일: heat.py 프로젝트: rbaravalle/Pysys
dy=0.001        # Interval size in y-direction.
a=4          # Diffusion constant.
timesteps=1000  # Number of time-steps to evolve system.

nx = int(1/dx)
ny = int(1/dy)

dx2=dx**2 # To save CPU cycles, we'll compute Delta x^2
dy2=dy**2 # and Delta y^2 only once and store them.

# For stability, this is the largest interval possible
# for the size of the time-step:
dt = dx2*dy2/( 2*a*(dx2+dy2) )

# Start u and ui off as zero matrices:
ui = 255-lsystem.lin()
ui.flags.writeable = True


#ui = np.ones([nx,ny])
u = np.zeros(ui.shape)

# Now, set the initial conditions (ui).
#for i in range(nx):
#    for j in range(ny):
#        if ( ( (i*dx-0.5)**2+(j*dy-0.5)**2 <= 0.1)
#            & ((i*dx-0.5)**2+(j*dy-0.5)**2>=.05) ):
#                ui[i,j] = 1

#for i in range(10,30):
    #for j in range(10,30):