dodal neki plotov za porocilo

master
Andrej 2021-06-11 10:21:37 +02:00
parent 747903f4e3
commit db6af93ee8
8 changed files with 38 additions and 12 deletions

Binary file not shown.

View File

@ -66,6 +66,7 @@ def plot3(X,enote='m',zemlja=False):
y = np.outer(np.sin(u), np.sin(v)) y = np.outer(np.sin(u), np.sin(v))
z = np.outer(np.ones(np.size(u)), np.cos(v)) z = np.outer(np.ones(np.size(u)), np.cos(v))
ax.plot_surface(x,y,z,zorder=-4) ax.plot_surface(x,y,z,zorder=-4)
#ax.set_box_aspect(np.ptp(X,axis=0))
ax.plot(X[:,0],X[:,1],X[:,2],zorder=4) ax.plot(X[:,0],X[:,1],X[:,2],zorder=4)
ax.set_xlabel(r'$x$ [{}]'.format(enote)) ax.set_xlabel(r'$x$ [{}]'.format(enote))
@ -74,17 +75,19 @@ def plot3(X,enote='m',zemlja=False):
plt.show() plt.show()
def rplot(X, enote='m', xy=[0,1],os='xy'): def rplot(X, enote='m', xy=[0,1],os='xy', fname=None):
fig = plt.figure() fig = plt.figure()
ax = fig.subplots() ax = fig.subplots()
ax.plot(X[:,xy[0]],X[:,xy[1]], 'k') ax.plot(X[:,xy[0]],X[:,xy[1]], 'k')
ax.grid() ax.grid()
dx = X[-1,xy[0]]-X[-2,xy[0]] dx = X[-1,xy[0]]-X[-2,xy[0]]
dy = X[-1,xy[1]]-X[-2,xy[1]] dy = X[-1,xy[1]]-X[-2,xy[1]]
ax.arrow(X[-1,xy[0]],X[-1,xy[1]],dx,dy,head_width=0.1,head_length=0.2, #ax.arrow(X[-1,xy[0]],X[-1,xy[1]],dx,dy,head_width=0.1,head_length=0.2,
overhang=0.3, zorder=10,color='k') # overhang=0.3, zorder=10,color='k')
ax.set_xlabel(r'${}$ [{}]'.format(os[0],enote)) ax.set_xlabel(r'${}$ [{}]'.format(os[0],enote))
ax.set_ylabel(r'${}$ [{}]'.format(os[1],enote)) ax.set_ylabel(r'${}$ [{}]'.format(os[1],enote))
if fname:
plt.savefig(fname,bbox_inches='tight')
plt.show() plt.show()

BIN
radii.pdf 100644

Binary file not shown.

View File

@ -12,12 +12,17 @@ B = lambda x: np.array([0.,0.,x[0]**2+x[1]**2])
E = lambda x: np.array([0.,0.,0.]) E = lambda x: np.array([0.,0.,0.])
x0 = np.array([0.,-1.,0.]) x0 = np.array([0.,-1.,0.])
v0 = np.array([0.,1.,0.]) v0 = np.array([-0.2,2.5,0.])
B = lambda x: np.array([0.,0.,1.])
E = lambda x: np.array([0.,-1.,0.])
E = lambda x: np.array([np.cos(x[0]),0.3,0.])
X,V = boris(x0,v0,E,B,1e-3, 100)
X,V = boris(x0,v0,E,B,1e-2, 100)
plot3(X) plot3(X)
rplot(X) rplot(X)
B = lambda x: np.array([0.,0.,1.])
E = lambda x: np.array([-0.,0.8,0.])
x0 = np.array([0.,0.,0.])
v0 = np.array([0.,2.5,0.])
X,V = boris(x0,v0,E,B,1e-2, 20)
plot3(X)
rplot(X,fname='statika.pdf')

BIN
statika.pdf 100644

Binary file not shown.

BIN
zemlja.pdf 100644

Binary file not shown.

View File

@ -19,8 +19,9 @@ K = K*e # v Jouleih
get_v0 = lambda K: c*np.sqrt(1-1/(K/(m*c**2)+1)**2) get_v0 = lambda K: c*np.sqrt(1-1/(K/(m*c**2)+1)**2)
x0 = np.array([4*Rz,0.,0.])
vpad = 30 x0 = np.array([2*Rz,0.,0.])
vpad = 45
v0 = get_v0(K)*np.array([0., np.sin(vpad*np.pi/180), np.cos(vpad*np.pi/180)]) v0 = get_v0(K)*np.array([0., np.sin(vpad*np.pi/180), np.cos(vpad*np.pi/180)])
E = lambda x: np.array([0.,0.,0.]) # elektricno polje je nula E = lambda x: np.array([0.,0.,0.]) # elektricno polje je nula
@ -28,5 +29,22 @@ dt = 1e-3
tsim = 20 tsim = 20
X, V = boris(x0, v0, E, B_zemlja, dt, tsim, q=q,m=m) X, V = boris(x0, v0, E, B_zemlja, dt, tsim, q=q,m=m)
plot3(X/Rz,enote="Rz", zemlja=True) x0 = np.array([4*Rz,0.,0.])
X2, V2 = boris(x0, v0, E, B_zemlja, dt, tsim, q=q,m=m)
def plot(X,X2,r=[2,4], fname=None):
fig = plt.figure()
ax = fig.subplots()
ax.plot(X[:,0],X[:,1],label='${}R_z$'.format(r[0]))
ax.plot(X2[:,0],X2[:,1],label='${}R_z$'.format(r[1]))
ax.grid()
ax.set_xlabel(r'$x$ [$R_z$]')
ax.set_ylabel(r'$y$ [$R_z$]')
ax.legend()
if fname:
plt.savefig(fname,bbox_inches='tight')
plt.show()
plot3(X2/Rz, enote="$R_z$",zemlja=True)
plot(X/Rz,X2/Rz,fname='radii.pdf')

BIN
zemlja2.pdf 100644

Binary file not shown.