E Field Distribution Solution on Three Charge Model

This time,a approach for three charge model of same charges


import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
npts=200

xmin, xmax = 1, 10
ymin, ymax = 1, 10
x = np.array([1, 1, 1, 5.5, 5.5, 5.5, 10, 10, 10])
y = np.array([1, 5.5, 10, 1, 5.5, 10, 1, 5.5, 10])
#Voltage input
z = np.array([0.68, 0.78, 0.435, 0.638, 0.555,
              0.263, 0.234, 0.532, 0.553])


xi = np.linspace(xmin, xmax, npts)
yi = np.linspace(ymin, ymax, npts)
zi = griddata((x, y), z, (xi[None,:], yi[:,None]), method='cubic')



plt.contour(xi, yi, zi, 15, linewidths=0.5, colors='k')
plt.pcolormesh(xi, yi, zi, cmap=plt.get_cmap('rainbow'))
plt.colorbar()
plt.scatter(x, y, marker='o', c='b', s=5, zorder=10)
plt.show()
plt.contourf(xi,yi,zi,15,cmap=plt.cm.jet)

plt.show()

#Input of Mean Voltage and distance for two-charge condition
#where,effect force on other charge on q=1 condition is calculating
vort=0.55
r=7.07
f=vort/r
print(f)


#Next,F=k(q.aq)/(r^2) formulation that calculates a coefficint of other charge
import math
k=9*10e9
us=math.pow(r,2)
print(us)
a=(f*us)/k
print(a)#other charge as a.q on q=1


#on q=1,third charge calculus with linear ratio approach
print("third radius value")
v=(input("value="))






#Total three voltage calculations that effected on onepoint
#Point location that for example(2,3)
xa=2
ya=3

#x1,y1 coordinates of calcuated charge
x1=1
y1=5
#And,V1 voltage calculations
p1=math.pow((xa-x1),2)
p2=math.pow((ya-y1),2)
v1=a/(p1+p2)
print(v1)

#x2,y2 coordinates of q=1 charge
x2=5
y2=10
#And,V2 voltage calculations
p3=math.pow((xa-x2),2)
p4=math.pow((ya-y2),2)
v2=1/(p3+p4)
print(v2)



#x3,y3 coordinates of calcuated charge
x3=10
y3=1
#And,V3 voltage calculations
p5=math.pow((xa-x3),2)
p6=math.pow((ya-y3),2)
v3=float(v)*(1./(p5+p6))
print(v3)

totalvtj=v1+v2+v3
print(totalvtj)


 
from scipy.interpolate import Rbf   
import matplotlib.cm as cm
#Voltage Gradient Calculation on Vector Field with x,y coordinates
x = [1,2,5,10] 
y = [5,3,10,1] 
voltages=[v1,totalvtj,v2,v3]

#Uniform area determination line
ti = np.linspace(0, 35.0, 35) 
XI, YI = np.meshgrid(ti, ti)   
#kriging function type(linear,multiquadric,inverse,gaussian,cubic,quintic,thin_plate)
rbf = Rbf(x, y, voltages, function='inverse') 
ZI = rbf(XI, YI)
# Conclusion Graph
plt.subplot(1, 1, 1) 
plt.pcolor(XI, YI, ZI,cmap=cm.RdBu_r) 
plt.scatter(x, y,1, voltages,cmap=cm.RdBu_r) 
plt.title('Voltage Gradient on Vector Field') 
plt.xlim(0, 35) 
plt.ylim(0, 35) 
plt.colorbar(orientation="vertical")
plt.show()

#E=-Grad(voltages) and next,plt.quiver(x,y,E) plotting
j=np.array(voltages, dtype=float)
opr=np.gradient(j)
Efield=-opr
print(Efield)

import pylab as plt
dx = np.linspace(0,35.0,35)
dy = np.linspace(0,35.0,35)

X,Y = np.meshgrid(dx,dy)
plt.quiver(X,Y,Efield,width=.01,headwidth=3,linewidth=1,cmap=cm.jet)
plt.colorbar()
plt.show()










and conclusions,















Yorumlar

Bu blogdaki popüler yayınlar

Important Tectonic Components of Turkey Geography based on Anatolian Plate

Informations about experimental plate structures

Obspy-about Developments