Project 3b: Wave propagation in magnetized plasmas:
Before anything else, we need to change to the stored notebook's directory, which contains input files for the PIC simulator.
cd /notebooks/x-mode-propagation
In this project, we are going to look at the propagation of an x-wave up a density gradient. The theory for high frequency waves propagating across a magnetic field in a plasma is in the notebook x-o-mode-theory. The goal of this project is for you to understand how the disperion relation can provide information regarding how a wave with a particular frequency behaves as it moves from vacuum into a magnetized plasma. You will study what happens with a wave starts with a frequency above the electron cyclotron frequency, but below the highest of the cut off frequencies, where is the plasma frequency at the highest density. You will launch waves into plasmas with either a sharp density rise or a gradual density rise. In both cases the electric field of the EM wave will be polarized in the direction (the wave moves in the direction and the applied magnetic field points in the direction). You will also launch a wave with a frequency above where the electric field of the wave is polarized in both the and directions (at an angle of ).
1. Plotting dispersion relations
The following several cells will plot relevant dispersion relations for magnetized plasmas near to what we will be simulating.
These are for waves in a plasma that has an external magnetic field such that and .
# The following takes care of some initialization from scipy.optimize import fsolve import numpy as np import matplotlib.pyplot as plt %matplotlib inline #first we define the range of k's of interest, "k" here means "ck" karray=np.arange(0,2,0.05) nk=karray.shape[0] def xwave_disp(w,omegap,omegac,ck): ratio=omegac/omegap y=(ck*ck)/(omegap*omegap)-(w*w)/(omegap*omegap)+(w*w/(omegap*omegap)-1)/(w*w/(omegap*omegap)-(1+ratio*ratio)) return y warrayL=np.zeros(karray.shape[0]); warrayR=np.zeros(karray.shape[0]) wLarray=np.zeros(karray.shape[0]); wRarray=np.zeros(karray.shape[0]) wHarray=np.zeros(karray.shape[0])
1.1. Plotting dispersion relation for
############# # here we specify the plasma conditions wp=1 wc=0.5 ############# wR=0.5*(wc+np.sqrt(4*wp*wp+wc*wc)) wL=0.5*(np.sqrt(4*wp*wp+wc*wc)-wc) wLarray[:]=wL wRarray[:]=wR wHarray[:]=np.sqrt(wp*wp+wc*wc) warrayL[0]=wL warrayR[0]=wR for ik in range(1,nk): warrayL[ik]=fsolve(xwave_disp,warrayL[ik-1],args=(wp,wc,karray[ik])) warrayR[ik]=fsolve(xwave_disp,warrayR[ik-1],args=(wp,wc,karray[ik])) plt.plot(karray,warrayR,'b',label='X wave '); plt.plot(karray,warrayL,'b',label='X wave') plt.plot(karray,wLarray,'--',label='$\omega_L$'); plt.plot(karray,wRarray,'--',label='$\omega_R$') plt.plot(karray,wHarray,'--',label='$\omega_H$') plt.xlabel('wave number $[ck/\omega_{pe}]$'); plt.ylabel('frequency $[\omega_{pe}]$') plt.title('X wave dispersion relation,'); plt.legend() plt.xlim([0,karray[nk-1]]); plt.ylim([0,karray[nk-1]+1.0]) plt.legend(loc=0) plt.show()
print('w_L = '+repr(wL)) print('w_R = '+repr(wR)) print('w_H = '+repr(np.sqrt(wp*wp+wc*wc)))
1.2. Plotting dispersion relation for
############# # here we specify the plasma conditions wp=1 wc=2.0 ############# wR=0.5*(wc+np.sqrt(4*wp*wp+wc*wc)) wL=0.5*(np.sqrt(4*wp*wp+wc*wc)-wc) wLarray[:]=wL wRarray[:]=wR wHarray[:]=np.sqrt(wp*wp+wc*wc) warrayL[0]=wL warrayR[0]=wR for ik in range(1,nk): warrayL[ik]=fsolve(xwave_disp,warrayL[ik-1],args=(wp,wc,karray[ik])) warrayR[ik]=fsolve(xwave_disp,warrayR[ik-1],args=(wp,wc,karray[ik])) plt.plot(karray,warrayR,'b',label='X wave '); plt.plot(karray,warrayL,'b',label='X wave') plt.plot(karray,wLarray,'--',label='$\omega_L$'); plt.plot(karray,wRarray,'--',label='$\omega_R$') plt.plot(karray,wHarray,'--',label='$\omega_H$') plt.xlabel('wave number $[ck/\omega_{pe}]$'); plt.ylabel('frequency $[\omega_{pe}]$') plt.title('X wave dispersion relation,'); plt.legend() plt.xlim([0,karray[nk-1]]); plt.ylim([0,karray[nk-1]+1.0]) plt.legend(loc=0) plt.show()
print('w_L = '+repr(wL)) print('w_R = '+repr(wR)) print('w_H = '+repr(np.sqrt(wp*wp+wc*wc)))
2. Simulations with a Particle-in-Cell Code
The goal of this project is to study what happens when an electromagnetic wave is sent into a magnetized plasma in which the wave moves across the magnetic field.
You will simulate plasmas in which each plasma electron is initialized with positions (only in or what we call ) such that the plasma has a nonuniform density profile. The spacing between the electrons is proportional to the inverse of the density. Each electron is also initialized with velocities ( , , ) = ( , , ) or momentum ( , , ) from a Maxwellian in each direction. The particles then begin to move in the self-consistent fields that their current and charge density produce. The peak density of the plasma in each case corresponds to =1.
For all cases, a constant magnetic field exists in the direction. It will be given a value corresponding to either or .
At , an electromagnetic (EM) wave is launched by an antenna from the left hand boundary along the direction. The pulse grows in amplitude over and then remains constant. In some cases the EM wave is polarized in the direction while in other cases it is polarized in the and directions at an angle of .
2.1. The following lines must always be executed before running anything else.
Reminder: Hit Shift+Enter to run a cell, or select the cell and click on the "Run" button in the top menu bar
import osiris %matplotlib inline
3. EM wave traveling up a density gradient; ; .
- The length of the simulation window is .
- There is no plasma between and .
- The plasma density rises linearly from to to a value and the corresponding plasma frequency is .
- The density then remains constant at from to .
- The simulation will run for a time 1100 .
- The simulation uses 50,000 particles.
You will launch a wave with its electric field pointing in the direction with . The peak value of the electric field will be .
Run the simulation below:
# w0=0.7 dirname = 'xmode-b05-w07' osiris.runosiris(rundir=dirname,inputfile='xmode-b05-w07.txt')
Plot the density:
dirname = 'xmode-b05-w07' osiris.phasespace(rundir=dirname,dataset='x1',time=0,xlim=[0,500])
You will next plot . The color corresponds to the amplitude of the EM wave. In addition, lines corresonding to the value of where the incoming EM wave's frequency equals , , , and are also shown.
dirname = 'xmode-b05-w07' osiris.plot_tx(rundir=dirname, b0_mag= 0.5, plot_or=2, w_0 = 0.7, n_peak = 1,one_0=40,one_D=360, show_theory=True,cmap='seismic',xlim=[0,500])
- Did the wave start out with a frequency above or below ?
- The wave is reflected. How can you tell?
- At which cutoff is it reflected?
Next, let's zoom in a bit to see the behavior near the turning point:
dirname = 'xmode-b05-w07' osiris.plot_tx(rundir=dirname, b0_mag= 0.5, plot_or=2, w_0 = 0.7, n_peak = 1,one_0=40,one_D=360, show_theory=True,cmap='seismic',xlim=[0,200],tlim=[50,400])
- What is the phase and group velocity when it is reflected?
- Is this what you expect from the dispersion relation?
4. Light wave traveling up a density gradient; ; .
This case is exactly the same as the first with the exception of the magnetic field amplitude.
- The length of the simulation window is .
- There is no plasma between and .
- The plasma density rises linearly from to to a value and the corresponding plasma frequency is .
- The density then remains constant at from to .
- The simulation will run for a time 1100 .
- The simulation uses 50,000 particles.
You will launch a wave with its electric field pointing in the direction with . The peak value of the electric field will be .
Run the simulation below:
# w0=0.7 w_p dirname = 'xmode-b20-w07' osiris.runosiris(rundir=dirname,inputfile='xmode-b20-w07.txt')
Plot the density:
dirname = 'xmode-b20-w07' osiris.phasespace(rundir=dirname,dataset='x1',time=0,xlim=[0,500])
Here we plot the wave pattern as it propagates up the density gradient:
dirname = 'xmode-b20-w07' osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=2, w_0 = 0.7, n_peak = 1, one_0=40,one_D=360, show_theory=True,cmap='RdBu')
- Did the wave start out with a frequency above or below when the density is 0?
- The wave is now transmitted. How can you tell?
- Can you explain why the wave does not get reflected in this case? (Hint: What is at the peak density?)
5. Light wave traveling up a density gradient; ; .
The third case is the same as the second with the exception of the laser frequency and amplitude (the amplitude does not change the results).
- The length of the simulation window is .
- There is no plasma between and .
- The plasma density rises linearly from to to a value and the corresponding plasma frequency is .
- The density then remains constant at from to .
- The simulation will run for a time 1100 .
- The simulation uses 50,000 particles.
You will launch a wave with its electric field pointing in the direction with . The peak value of the electric field will be .
Run the simulation below:
# w0= 0.3 w_p dirname = 'xmode-b20-w03' osiris.runosiris(rundir=dirname,inputfile='xmode-b20-w03.txt')
Plot the density:
dirname = 'xmode-b20-w03' osiris.phasespace(rundir=dirname,dataset='x1',time=0,xlim=[0,500])
Next you will plot .
dirname = 'xmode-b20-w03' osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=2, w_0 = 0.3, n_peak = 1, one_0=40,one_D=360,show_theory=True,cmap='seismic')
- Why is the wave now reflected?
- Why is the wave now reflected at the density for which = ?
- What is the phase and group velocity when it is reflected?
6. Light wave incident on a very sharp density gradient; ; .
In the last case, the density will rise sharply from 0, then stay constant at = , and then fall sharply back to zero:
- The length of the simulation window is .
- There is no plasma between and .
- The plasma density rises sharply at to a value and the corresponding plasma frequency is .
- The density then remains constant at from to .
- The density decreases sharply to 0 at and remains 0 until to .
- The simulation will run for a time 450 .
- The simulation uses 50,000 particles.
In this case you will launch a wave with and its electric field will have equal values for Ey and Ez ( and ). The peak value of the electric field will be .
Run the simulation below:
# w0=1.5, flat density profile dirname = 'xmode-b05-flat-2.2' osiris.runosiris(rundir=dirname,inputfile='xmode-b05-flat.txt')
Plot the density:
dirname = 'xmode-b05-flat-2.2' osiris.phasespace(rundir=dirname,dataset='x1',time=0,xlim=[0,100])
Next you will plot and . First let's look at the entire time window:
dirname = 'xmode-b05-flat-2.2' osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=2, w_0 = 0.7, n_peak = 1,show_theory=False,cmap='RdBu',xlim=[0,100],tlim=[0,450],vmin=-0.03,vmax=0.03) osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=3, w_0 = 0.7, n_peak = 1,show_theory=False,cmap='RdBu',xlim=[0,100],tlim=[0,450],vmin=-0.03,vmax=0.03)
- What type of wave does the correspond to?
- What type of wave does the correspond to?
Although they look similar, we show next that these two "waves" have slightly different group and phase velocities. This can be seen by looking at the data in a small time window. The two different waves arrive at the wall ( =100) at slightly different times.
dirname = 'xmode-b05-flat-2.2' osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=2, w_0 = 0.7, n_peak = 1,show_theory=False,cmap='RdBu',vmin=-0.03,vmax=0.03,tlim=[112,118],xlim=[0,100]) osiris.plot_tx(rundir=dirname, b0_mag= 2.0, plot_or=3, w_0 = 0.7, n_peak = 1,show_theory=False,cmap='RdBu',vmin=-0.03,vmax=0.03,tlim=[112,118],xlim=[0,100])
Next we plot dots of the values of the electric field on an vs. plot. Each dot corresponds to a different time. The colors correspond to different values of . Blue is for an in the vacuum before the EM wave enters the plasma, red is for an in the plasma, and green is for an in the vacuum after the wave exits the plasma.
- the blue line is the polarization as a function of time at
- the red line is the polarization as a function of time at
- the green line is the polarization as a function of time at
dirname = 'xmode-b05-flat-2.2' from h5_utilities import * import matplotlib.pyplot as plt e2=read_hdf(dirname+'/e2.h5') e3=read_hdf(dirname+'/e3.h5') nt = e2.data.shape[0] tmax=e2.axes[1].axis_max dt=tmax/(nt) time_axis=np.arange(0,tmax,dt) plt.scatter(e2.data[:,10],e3.data[:,10],c='b',label='in vacuum at x1=2',s=2) plt.scatter(e2.data[:,240],e3.data[:,240],c='r',label='in plasma at x1=48',s=2) plt.scatter(e2.data[:,480],e3.data[:,480],c='green',label='in vacuum at x1=96',s=2) plt.legend() plt.xlabel('$E_2$',fontsize=18) plt.ylabel('$E_3$',fontsize=18) plt.show()
Can you explain this plot? The blue dots should form a straight line, but some of the signal is reflected which makes it more complicated. Understanding this result will be helpful for the final exam.