aboutsummaryrefslogtreecommitdiff
path: root/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2019-08-15 11:42:10 -0700
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2019-08-15 11:42:10 -0700
commitbebb5fe0bb2067f37705bdc85e9cb7986495694c (patch)
tree5f59ff84e6aabb5dac77bed3656da1af0fca7682 /Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py
parentac26af7ea220b08b011563794c0c6348a69bc303 (diff)
downloadWarpX-bebb5fe0bb2067f37705bdc85e9cb7986495694c.tar.gz
WarpX-bebb5fe0bb2067f37705bdc85e9cb7986495694c.tar.zst
WarpX-bebb5fe0bb2067f37705bdc85e9cb7986495694c.zip
add comments in analysis scripts
Diffstat (limited to 'Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py')
-rwxr-xr-xExamples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py
index 8918c7948..86214ad72 100755
--- a/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py
+++ b/Examples/Modules/RigidInjection/analysis_rigid_injection_LabFrame.py
@@ -1,5 +1,18 @@
#! /usr/bin/env python
+'''
+Analysis script of a WarpX simulation of rigid injection.
+
+A Gaussian electron beam starts from -5 microns, propagates rigidly up to
+20 microns after which it expands due to emittance only (the focal position is
+20 microns). The beam width is measured after ~50 microns, and compared with
+the theory (with a 5% error allowed).
+
+As a help to the user, the script also compares beam width to the theory in
+case rigid injection is OFF (i.e., the beam starts expanding from -5 microns),
+in which case a warning is raised.
+'''
+
import sys
import yt
import numpy as np
@@ -51,5 +64,7 @@ if ( error_no_rigid < 0.05):
wth = np.sqrt( w0**2 + (z-z0)**2*theta0**2 )
error = np.abs((w-wth)/wth)
# Print error and assert small error
+print("Beam position: " + str(z))
+print("Beam width : " + str(w))
print("error: " + str(error))
assert( error < 0.05 )