Open MaxThevenet opened 2 years ago
For normalized units: This script with this input file can be used to run simulations w/ w/o collisions in SI/normalized units. The analysis can be done with
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
import scipy.constants as scc
from openpmd_viewer import OpenPMDTimeSeries
tsh1 = OpenPMDTimeSeries('/p/scratch/plasmabbq/maxence/hipace_collisions/hipace_normalized/nocoll_diags')
tsh2 = OpenPMDTimeSeries('/p/scratch/plasmabbq/maxence/hipace_collisions/hipace_normalized/coll_diags')
tsh3 = OpenPMDTimeSeries('/p/scratch/plasmabbq/maxence/hipace_collisions/hipace_normalized/nocoll_diags_SI')
tsh4 = OpenPMDTimeSeries('/p/scratch/plasmabbq/maxence/hipace_collisions/hipace_normalized/coll_diags_SI')
it1 = 1000
kp_inv = 10.e-6
efac = scc.e*kp_inv/(scc.m_e*scc.c**2)
iteration = 0
Fh1, mh1 = tsh1.get_field(iteration=iteration, field='Ez')
Fh2, mh2 = tsh2.get_field(iteration=iteration, field='Ez')
Fh3, mh3 = tsh3.get_field(iteration=iteration, field='Ez')
Fh4, mh4 = tsh4.get_field(iteration=iteration, field='Ez')
clim = (-1.e6, 1.e6)
clim0 = (-1.e9,1.e9) # (-1.e11, 1.e11) # (-1.e9,1.e9)
plt.figure(figsize=(10,6))
plt.subplot(231)
plt.imshow(Fh1/efac, aspect='auto')
plt.clim(clim0)
plt.colorbar()
plt.title('HiPACE++ no collisions')
plt.xlabel('x')
plt.ylabel('z')
plt.subplot(232)
plt.imshow(Fh2/efac, aspect='auto')
plt.colorbar()
plt.xlabel('x')
plt.ylabel('z')
plt.clim(clim0)
plt.title('HiPACE++ collisions')
plt.subplot(233)
plt.imshow(Fh2/efac-Fh1/efac, aspect='auto')
plt.colorbar()
# plt.clim(clim)
plt.xlabel('x')
plt.ylabel('z')
plt.title('difference')
plt.subplot(234)
plt.imshow(Fh3, aspect='auto')
plt.clim(clim0)
plt.colorbar()
plt.title('HiPACE++ no collisions')
plt.xlabel('x')
plt.ylabel('z')
plt.subplot(235)
plt.imshow(Fh4, aspect='auto')
plt.colorbar()
plt.xlabel('x')
plt.ylabel('z')
plt.clim(clim0)
plt.title('HiPACE++ collisions')
plt.subplot(236)
plt.imshow(Fh4-Fh3, aspect='auto')
plt.colorbar()
plt.clim(clim)
plt.xlabel('x')
plt.ylabel('z')
plt.title('difference')
plt.tight_layout()
Collisions in normalized units were enabled in #962.
With the fix of #967 and using plasma insitu-diagnostics, inter-species collisions were tested. Note that to avoid numerical noise etc and just test the collision module, the field solver was commented out. Using the following inputs script and testing vs analytical theory as done in the smilei documentation the following result was obtained for collisions between electrons and light ions (H+ with a mass 10*m_e
):
Here are remaining tests/tasks for the collision module (see PR #676), in order of priorities: