-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: AlexanderSinn <[email protected]> Co-authored-by: Alexander Sinn <[email protected]> Co-authored-by: Maxence Thévenet <[email protected]>
- Loading branch information
1 parent
49dc5f7
commit 29c2a53
Showing
15 changed files
with
614 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#! /usr/bin/env python3 | ||
|
||
# | ||
# This file is part of HiPACE++. | ||
# | ||
# Authors: EyaDammak | ||
|
||
import argparse | ||
import numpy as np | ||
import math | ||
from openpmd_viewer import OpenPMDTimeSeries | ||
import statistics | ||
from scipy.constants import e as qe | ||
parser = argparse.ArgumentParser( | ||
description='Script to analyze the equality of two simulations') | ||
parser.add_argument('--first', | ||
dest='first', | ||
required=True, | ||
help='Path to the directory containing output files') | ||
parser.add_argument('--second', | ||
dest='second', | ||
required=True, | ||
help='Path to the directory containing output files') | ||
args = parser.parse_args() | ||
|
||
ts_linear = OpenPMDTimeSeries(args.first) | ||
ts_circular = OpenPMDTimeSeries(args.second) | ||
|
||
a0_linear = 0.00885126 | ||
a0_circular = 0.00787934 | ||
|
||
nc = 1.75e27 | ||
n0 = nc / 10000 | ||
|
||
iteration = 0 | ||
|
||
rho_elec_linear, _ = ts_linear.get_field(field='rho_elec', coord='z', iteration=iteration) | ||
rho_elec_mean_linear = np.mean(rho_elec_linear, axis=(1, 2)) | ||
rho_average_linear = statistics.mean(rho_elec_mean_linear[0:10]) | ||
fraction_linear = -rho_average_linear / qe / n0 | ||
|
||
rho_elec_circular, _ = ts_circular.get_field(field='rho_elec', coord='z', iteration=iteration) | ||
rho_elec_mean_circular = np.mean(rho_elec_circular, axis=(1, 2)) | ||
rho_average_circular = statistics.mean(rho_elec_mean_circular[0:10]) #average over a thickness in the ionized region | ||
fraction_circular = -rho_average_circular / qe / n0 | ||
|
||
fraction_warpx_linear = 0.41014984 # result from WarpX simulation | ||
fraction_warpx_circular = 0.502250841 # result from WarpX simulation | ||
|
||
relative_diff_linear = np.abs( ( fraction_linear - fraction_warpx_linear ) / fraction_warpx_linear ) | ||
relative_diff_circular = np.abs( ( fraction_circular - fraction_warpx_circular ) / fraction_warpx_circular ) | ||
|
||
tolerance = 0.25 | ||
print(f"fraction_warpx_linear = {fraction_warpx_linear}") | ||
print(f"fraction_hipace_linear = {fraction_linear}") | ||
print(f"fraction_warpx_circular = {fraction_warpx_circular}") | ||
print(f"fraction_hipace_circular = {fraction_circular}") | ||
|
||
assert ( (relative_diff_linear < tolerance) and (relative_diff_circular < tolerance) ), 'Test laser_ionization did not pass' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
max_step = 0 | ||
hipace.dt = 0 | ||
hipace.verbose = 3 | ||
|
||
amr.n_cell = 32 32 50 | ||
|
||
|
||
my_constants.kp_inv = 10.e-6 | ||
|
||
my_constants.nc = 1.75e27 | ||
my_constants.n0 = nc/10000 | ||
|
||
my_constants.a0 = 0.00885126 | ||
|
||
my_constants.w0_um = 1.e8 | ||
my_constants.tau_fs = 30/1.17741 | ||
my_constants.lambda0_nm = 800 | ||
|
||
hipace.file_prefix = laser_ionization.1Rank | ||
hipace.do_tiling = 0 | ||
hipace.deposit_rho_individual = 1 | ||
|
||
geometry.prob_lo = -10.*kp_inv -10.*kp_inv -15.*kp_inv #box shifted | ||
geometry.prob_hi = 10.*kp_inv 10.*kp_inv 5.*kp_inv | ||
|
||
lasers.names = laser | ||
lasers.lambda0 = lambda0_nm * 1.e-9 | ||
|
||
|
||
laser.a0 = a0 | ||
laser.position_mean = 0. 0. 0 | ||
laser.w0 = w0_um*1.e-6 | ||
laser.tau = tau_fs*1.e-15 | ||
laser.focal_distance = 50.e-6 | ||
|
||
plasmas.names = elec ion | ||
|
||
elec.density(x,y,z) = n0 | ||
elec.ppc = 0 0 | ||
elec.u_mean = 0.0 0.0 0.0 | ||
elec.element = electron | ||
elec.neutralize_background = false | ||
|
||
ion.density(x,y,z) = n0 | ||
ion.ppc = 1 1 | ||
ion.u_mean = 0.0 0.0 0.0 | ||
ion.element = H | ||
ion.mass_Da = 1.008 | ||
ion.initial_ion_level = 0 | ||
ion.can_laser_ionize = 1 | ||
ion.ionization_product = elec | ||
|
||
amr.max_level = 0 | ||
|
||
diagnostic.output_period = 1 | ||
|
||
hipace.depos_order_xy = 0 | ||
|
||
boundary.field = Dirichlet | ||
boundary.particle = Periodic | ||
|
||
diagnostic.diag_type = xyz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.