Reference: Sugiyama2001JGR
mdvdt=q(E+vc×B)
Normalization:
t→t′Ωpx→x′vAΩpB,E→B′B0,E′B0
dv′dt′=(cvA)E′+v′×B′
Electromagnetic fields obey the Faraday's law:k′×E′=(vAc)(ωΩp)B′.
We put a circulary polarized wave in the background magnetic field B0=B0ex: ˜b=by+ibz=bwexp[i(k′x′−ω′t′+ϕw)].
This wave is compressed and amplified at the shock front and the shock profile is modeled as: 1+12(r−1)[1+tanh(xD)].
Simulation parameters in the shock rest frame: k′=2π/56.6, c′p=4, v′u=5, v′t=1.6, b′w=0.6.
We assume a shell distribution with the thermal velocity v′t.
%config InlineBackend.figure_format = 'retina'
from numba import jit,f8,u8
import numpy as np
import math as mt
import matplotlib.pyplot as plt
import math as mt
from scipy.fftpack import fft, ifft,fft2,fftshift
import time
from IPython import display
plt.rcParams['font.size'] = 14
plt.rcParams['axes.linewidth'] = 1.5
lw=56.6
nx=1000
D=0.01*56.6
r=4
x=np.linspace(-50,50,nx)
ysh=1+0.5*(r-1)*(1+np.tanh(x/D))
kw=2*np.pi/lw*ysh
yw=np.sin(kw*x)*0.2*ysh+2
plt.plot(x,ysh,'-k')
plt.plot(x,yw)
plt.axis('off')
plt.show()
it=1000
f1 =open('data/up1%05d.d' %(it) ,'rb')
up1 =np.fromfile(f1, dtype='float64' ).reshape(-1,6)
th=np.linspace(0,2*np.pi,100)
for ir in range(20):
r=ir*1.0
plt.plot(r*(np.cos(th))+4,r*np.sin(th),'k',lw=0.5)
plt.plot(r*(np.cos(th))+1,r*np.sin(th),'--k',lw=0.5)
plt.plot(up1[:,3],np.sqrt(up1[:,4]**2+up1[:,5]**2),'.r',markersize=0.4)
plt.xlabel(r'$v_x/v_A$')
plt.ylabel(r'$v_\perp/v_A$')
plt.xlim(-12,12)
plt.ylim( 0,12)
plt.show()
xmin=-100
xmax= 100
bins=200
enmin=1e1
enmax=1000
ene1=up1[:,3]**2+up1[:,4]**2+up1[:,5]**2
plt.hist(ene1[np.where((up1[:,0]>=xmin)&(up1[:,0]<xmax))],bins=np.logspace(np.log10(enmin),np.log10(enmax),bins),log=True,histtype='step',color='b')
plt.yscale('log')
plt.xscale('log')
plt.xlabel('Energy')
plt.ylabel('df(E)/dE')
plt.xlim(enmin,enmax)
plt.show()
it=1000
f1 =open('data/up1%05d.d' %(it), 'rb')
up1=np.fromfile(f1,dtype='float64').reshape(-1,6)
print(np.where(up1[:,3]**2+up1[:,4]**2+up1[:,5]>120))
nt=1000; isav=1
ptrj=np.zeros((nt//isav,3))
ip=45126
for it in range(nt//isav):
f1 =open('data/up1%05d.d' %(it) ,'rb')
up1 =np.fromfile(f1, dtype='float64' ).reshape(-1,6)
ptrj[it,0]=up1[ip,0]
ptrj[it,1]=up1[ip,3]
ptrj[it,2]=np.sqrt(up1[ip,4]**2+up1[ip,5]**2)
plt.plot(ptrj[:,0],ptrj[:,1]**2+ptrj[:,2]**2)
plt.xlabel(r'$x/(v_A/\Omega_p)$')
plt.ylabel('Energy')
plt.show()
th=np.linspace(0,2*np.pi,100)
for ir in range(20):
r=ir*1.0
plt.plot(r*(np.cos(th))+4,r*np.sin(th),'k',lw=0.5)
plt.plot(r*(np.cos(th))+1,r*np.sin(th),'--k',lw=0.5)
plt.plot(ptrj[:,1],ptrj[:,2],'-r')
plt.xlim(-12,12)
plt.ylim( 0,12)
plt.xlabel(r'$v_x/v_A$')
plt.ylabel(r'$v_\perp/v_A$')
plt.show()