diff options
Diffstat (limited to 'Examples')
13 files changed, 39 insertions, 40 deletions
diff --git a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py index 86214ad72..21bfcf945 100755 --- a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py +++ b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py @@ -23,7 +23,7 @@ filename = sys.argv[1] # WarpX headers include more data when rigid injection is used, # which gives an error with the last yt release. -# To avoid this issue, the three last lines of WarpXHeader are removed if +# To avoid this issue, the three last lines of WarpXHeader are removed if # needed. def remove_rigid_lines(plotfile, nlines_if_rigid): header_name = plotfile + '/WarpXHeader' @@ -32,7 +32,7 @@ def remove_rigid_lines(plotfile, nlines_if_rigid): nlines = len(file_lines) f.close() if nlines == nlines_if_rigid: - f = open(header_name, 'w') + f = open(header_name, 'w') f.writelines(file_lines[:-3]) f.close() diff --git a/Examples/Modules/ionization/ionization_analysis.py b/Examples/Modules/ionization/ionization_analysis.py index b94541f90..f512eac6e 100755 --- a/Examples/Modules/ionization/ionization_analysis.py +++ b/Examples/Modules/ionization/ionization_analysis.py @@ -4,12 +4,12 @@ This script tests the result of the ionization module in WarpX. Input files inputs.rt and inputs.bf.rt are used to reproduce the test from -Chen, JCP, 2013, figure 2 (in the lab frame and in a boosted frame, +Chen, JCP, 2013, figure 2 (in the lab frame and in a boosted frame, respectively): a plane-wave laser pulse propagates through a uniform N2+ neutral plasma and further ionizes the Nitrogen atoms. This test checks that, after the laser went through the plasma, ~32% of Nitrogen ions are N5+, in agreement with theory from Chen's article. -""" +""" import sys import yt diff --git a/Examples/Physics_applications/laser_acceleration/README.md b/Examples/Physics_applications/laser_acceleration/README.md index c556a1d9e..914eda74e 100644 --- a/Examples/Physics_applications/laser_acceleration/README.md +++ b/Examples/Physics_applications/laser_acceleration/README.md @@ -11,4 +11,3 @@ Examples are provided using the executable or Python-driven version of WarpX. ## Using the python-driven version: - laser_acceleration_PICMI.py -
\ No newline at end of file diff --git a/Examples/Physics_applications/laser_acceleration/laser_acceleration_PICMI.py b/Examples/Physics_applications/laser_acceleration/laser_acceleration_PICMI.py index 4dca7151e..24d23310e 100644 --- a/Examples/Physics_applications/laser_acceleration/laser_acceleration_PICMI.py +++ b/Examples/Physics_applications/laser_acceleration/laser_acceleration_PICMI.py @@ -15,11 +15,11 @@ laser_duration = 15e-15 # Duration of the laser (in seconds) laser_polarization = np.pi/2. # Polarization angle (in rad) laser_injection_loc = 9.e-6 # Position of injection (in meters, along z) laser_focal_distance = 100.e-6 # Focal distance from the injection (in meters) -laser_t_peak = 30.e-15 # The time at which the laser reaches its peak +laser_t_peak = 30.e-15 # The time at which the laser reaches its peak # at the antenna injection location (in seconds) # --- plasma -plasma_density = 1.e24 +plasma_density = 1.e24 plasma_min = [-20.e-6, -20.e-6, 0.0e-6] plasma_max = [ 20.e-6, 20.e-6, 1.e-3] @@ -55,12 +55,12 @@ number_per_cell_each_dim = [2, 2, 1] # --- laser -laser = picmi.GaussianLaser(wavelength = laser_wavelength, - waist = laser_waist, - duration = laser_duration, - focal_position = [0., 0., laser_focal_distance + laser_injection_loc], - centroid_position = [0., 0., laser_injection_loc - picmi.c*laser_t_peak], - polarization_angle = laser_polarization, +laser = picmi.GaussianLaser(wavelength = laser_wavelength, + waist = laser_waist, + duration = laser_duration, + focal_position = [0., 0., laser_focal_distance + laser_injection_loc], + centroid_position = [0., 0., laser_injection_loc - picmi.c*laser_t_peak], + polarization_angle = laser_polarization, propagation_direction = [0,0,1], E0 = laser_a0*2.*np.pi*picmi.m_e*picmi.c**2/(picmi.q_e*laser_wavelength)) # Maximum amplitude of the laser field (in V/m) diff --git a/Examples/Physics_applications/plasma_acceleration/inputs.2d b/Examples/Physics_applications/plasma_acceleration/inputs.2d index 58f517308..fb67dd448 100644 --- a/Examples/Physics_applications/plasma_acceleration/inputs.2d +++ b/Examples/Physics_applications/plasma_acceleration/inputs.2d @@ -10,8 +10,8 @@ amr.plot_file = "plotfiles/plt" amr.plot_int = 100 geometry.coord_sys = 0 # 0: Cartesian geometry.is_periodic = 0 0 # Is periodic? -geometry.prob_lo = -125.e-6 -149.e-6 -geometry.prob_hi = 125.e-6 1.e-6 +geometry.prob_lo = -125.e-6 -149.e-6 +geometry.prob_hi = 125.e-6 1.e-6 warpx.fine_tag_lo = -12.e-6 -110.e-6 warpx.fine_tag_hi = 12.e-6 -100.e-6 diff --git a/Examples/Physics_applications/plasma_acceleration/inputs.2d.boost b/Examples/Physics_applications/plasma_acceleration/inputs.2d.boost index ba9166dee..d711815eb 100644 --- a/Examples/Physics_applications/plasma_acceleration/inputs.2d.boost +++ b/Examples/Physics_applications/plasma_acceleration/inputs.2d.boost @@ -10,7 +10,7 @@ amr.plot_file = "plotfiles/plt" amr.plot_int = 500 geometry.coord_sys = 0 # 0: Cartesian geometry.is_periodic = 0 0 # Is periodic? -geometry.prob_lo = -125.e-6 -149.e-6 +geometry.prob_lo = -125.e-6 -149.e-6 geometry.prob_hi = 125.e-6 1.e-6 ################################# diff --git a/Examples/Physics_applications/plasma_acceleration/inputs.3d.boost b/Examples/Physics_applications/plasma_acceleration/inputs.3d.boost index 1af4fac86..42446a9ac 100644 --- a/Examples/Physics_applications/plasma_acceleration/inputs.3d.boost +++ b/Examples/Physics_applications/plasma_acceleration/inputs.3d.boost @@ -10,8 +10,8 @@ amr.plot_file = "plotfiles/plt" amr.plot_int = 50 geometry.coord_sys = 0 # 0: Cartesian geometry.is_periodic = 1 1 0 # Is periodic? -geometry.prob_lo = -0.00015 -0.00015 -0.00012 -geometry.prob_hi = 0.00015 0.00015 1.e-06 +geometry.prob_lo = -0.00015 -0.00015 -0.00012 +geometry.prob_hi = 0.00015 0.00015 1.e-06 ################################# ############ NUMERICS ########### diff --git a/Examples/Tests/Larmor/plot_particle_path.py b/Examples/Tests/Larmor/plot_particle_path.py index 0a9e965e7..ef52b4f4b 100644 --- a/Examples/Tests/Larmor/plot_particle_path.py +++ b/Examples/Tests/Larmor/plot_particle_path.py @@ -3,8 +3,8 @@ import numpy as np class AMReXParticleHeader(object): ''' - This class is designed to parse and store the information - contained in an AMReX particle header file. + This class is designed to parse and store the information + contained in an AMReX particle header file. Usage: @@ -66,11 +66,11 @@ class AMReXParticleHeader(object): entry = [int(val) for val in f.readline().strip().split()] self.grids[level_num].append(tuple(entry)) - + def read_particle_data(fn, ptype="particle0"): ''' - This function returns the particle data stored in a particular + This function returns the particle data stored in a particular plot file and particle type. It returns two numpy arrays, the first containing the particle integer data, and the second the particle real data. For example, if a dataset has 3000 particles, @@ -79,22 +79,22 @@ def read_particle_data(fn, ptype="particle0"): with the shape (3000, 5). Usage: - + idata, rdata = read_particle_data("plt00000", "particle0") ''' base_fn = fn + "/" + ptype header = AMReXParticleHeader(base_fn + "/Header") - - idtype = "(%d,)i4" % header.num_int + + idtype = "(%d,)i4" % header.num_int if header.real_type == np.float64: fdtype = "(%d,)f8" % header.num_real elif header.real_type == np.float32: fdtype = "(%d,)f4" % header.num_real - + idata = np.empty((header.num_particles, header.num_int )) rdata = np.empty((header.num_particles, header.num_real)) - + ip = 0 for lvl, level_grids in enumerate(header.grids): for (which, count, where) in level_grids: @@ -107,7 +107,7 @@ def read_particle_data(fn, ptype="particle0"): floats = np.fromfile(f, dtype = fdtype, count=count) idata[ip:ip+count] = ints - rdata[ip:ip+count] = floats + rdata[ip:ip+count] = floats ip += count return idata, rdata @@ -121,10 +121,10 @@ if __name__ == "__main__": y0 = [] x1 = [] y1 = [] - + fn_list = glob.glob("plt?????") fn_list.sort() - + for fn in fn_list: idata, rdata = read_particle_data(fn, ptype="particle0") x0.append(rdata[0][0]) diff --git a/Examples/Tests/PML/analysis_pml_ckc.py b/Examples/Tests/PML/analysis_pml_ckc.py index e095864c0..d6bef942f 100755 --- a/Examples/Tests/PML/analysis_pml_ckc.py +++ b/Examples/Tests/PML/analysis_pml_ckc.py @@ -34,4 +34,4 @@ print("Reflectivity", Reflectivity) print("Reflectivity_theory", Reflectivity_theory) assert( Reflectivity < 105./100 * Reflectivity_theory ) - + diff --git a/Examples/Tests/PML/analysis_pml_psatd.py b/Examples/Tests/PML/analysis_pml_psatd.py index ff3bf8413..ba9120c8d 100755 --- a/Examples/Tests/PML/analysis_pml_psatd.py +++ b/Examples/Tests/PML/analysis_pml_psatd.py @@ -31,4 +31,4 @@ Reflectivity = energy_end/energy_start Reflectivity_theory = 1.3806831258153887e-06 assert( abs(Reflectivity-Reflectivity_theory) < 5./100 * Reflectivity_theory ) - + diff --git a/Examples/Tests/PML/analysis_pml_yee.py b/Examples/Tests/PML/analysis_pml_yee.py index 6234cd5d2..0def05450 100755 --- a/Examples/Tests/PML/analysis_pml_yee.py +++ b/Examples/Tests/PML/analysis_pml_yee.py @@ -31,4 +31,4 @@ Reflectivity = energy_end/energy_start Reflectivity_theory = 5.683000058954201e-07 assert( abs(Reflectivity-Reflectivity_theory) < 5./100 * Reflectivity_theory ) - + diff --git a/Examples/Tests/particles_in_PML/analysis.py b/Examples/Tests/particles_in_PML/analysis.py index 9d0c95d35..ab5792082 100755 --- a/Examples/Tests/particles_in_PML/analysis.py +++ b/Examples/Tests/particles_in_PML/analysis.py @@ -3,9 +3,9 @@ This script tests the absorption of particles in the PML. The input file inputs_2d/inputs is used: it features a positive and a -negative particle, going in opposite direction and eventually +negative particle, going in opposite direction and eventually leaving the box. This script tests that the field in the box -is close to 0 once the particles have left. With regular +is close to 0 once the particles have left. With regular PML, this test fails, since the particles leave a spurious charge, with associated fields, behind them. """ @@ -34,4 +34,4 @@ elif ds.dimensionality == 3: assert max_Efield < 10 else: raise ValueError("Unknown dimensionality") - + diff --git a/Examples/Tests/subcycling/inputs.2d b/Examples/Tests/subcycling/inputs.2d index 2ddd665e5..917d0fc14 100644 --- a/Examples/Tests/subcycling/inputs.2d +++ b/Examples/Tests/subcycling/inputs.2d @@ -10,7 +10,7 @@ amr.max_level = 1 amr.plot_file = "plotfiles/plt" amr.plot_int = 200 -warpx.fine_tag_lo = -2.e-6 -15.e-6 +warpx.fine_tag_lo = -2.e-6 -15.e-6 warpx.fine_tag_hi = 2.e-6 -7.e-6 @@ -28,9 +28,9 @@ warpx.use_filter = 1 warpx.do_pml = 1 warpx.do_subcycling = 1 warpx.refine_plasma = 0 -warpx.plot_raw_fields = 1 -warpx.plot_raw_fields_guards = 1 -warpx.plot_finepatch = 1 +warpx.plot_raw_fields = 1 +warpx.plot_raw_fields_guards = 1 +warpx.plot_finepatch = 1 warpx.plot_crsepatch = 1 warpx.n_current_deposition_buffer = 0 warpx.n_field_gather_buffer = 0 |