示例#1
0
def checkphi(v,q,w,i,k,T,ns,phim):
    check = phim
    for t in np.arange(ns):
        if phi(v,q,w,i,t,T)>check:
           check = phi(v,q,w,i,t,T)
        elif phi(v,q,w,k,t,T)>check:
           check = phi(v,q,w,k,t,T)
    return check
vol = []
charge = []
pos = 0 #no of succesful collisions

#phi0 = (2*1.3806488*10^(-23)*T)/(3*8.90*10^(-4))

phim = phimax(v,q,w,T,ns)
X = np.arange(0,ns) 

while pos<10000:
    #Checking collsion and coalescence for particles i and k
    while True:
        [i,k]=np.random.choice(X,2)
        z= np.random.sample()
        if(z*phim>phi(v,q,w,i,k,T)): break
    
    if w[i]==w[k]:
        w[i] = w[i]/2
        w[k] = w[k]/2
	
	temp = v[i]
        v[i] = v[i] + v[k]
        v[k] = temp
	
	temp = q[i]
        q[i] = q[i] + q[k]
        q[k] = temp
        
    else:
        temp = v[i]
示例#3
0
def phimax(v,q,w,T,ns): #computing phimax at a given stage
	phimax = 0
	for l in np.arange(ns):
	    for j in np.arange(l+1,ns):
        	if(phi(v,q,w,l,j,T)>phimax): phimax = phi(v,q,w,l,j,T)
	return phimax
示例#4
0
def power(a, b, c):
    if (b < 0):
        a = inv(a, c)
        b = abs(b)

    return calc(a, phi(c), c) * calc(a, b - phi(c), c)