aboutsummaryrefslogtreecommitdiff
path: root/Examples/Tests/Langmuir/analysis_langmuir_multi.py
diff options
context:
space:
mode:
Diffstat (limited to 'Examples/Tests/Langmuir/analysis_langmuir_multi.py')
-rwxr-xr-xExamples/Tests/Langmuir/analysis_langmuir_multi.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Examples/Tests/Langmuir/analysis_langmuir_multi.py b/Examples/Tests/Langmuir/analysis_langmuir_multi.py
index 9a2335bfe..e19f855cf 100755
--- a/Examples/Tests/Langmuir/analysis_langmuir_multi.py
+++ b/Examples/Tests/Langmuir/analysis_langmuir_multi.py
@@ -15,6 +15,7 @@
# $$ E_y = \epsilon \,\frac{m_e c^2 k_y}{q_e}\cos(k_x x)\sin(k_y y)\cos(k_z z)\sin( \omega_p t)$$
# $$ E_z = \epsilon \,\frac{m_e c^2 k_z}{q_e}\cos(k_x x)\cos(k_y y)\sin(k_z z)\sin( \omega_p t)$$
import sys
+import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
@@ -26,6 +27,9 @@ from scipy.constants import e, m_e, epsilon_0, c
# this will be the name of the plot file
fn = sys.argv[1]
+# Parse test name and check if current correction (psatd.do_current_correction=1) is applied
+current_correction = True if re.search( 'current_correction', fn ) else False
+
# Parameters (these parameters must match the parameters in `inputs.multi.rt`)
epsilon = 0.01
n = 4.e24
@@ -122,3 +126,13 @@ print("error_rel : " + str(error_rel))
print("tolerance_rel: " + str(tolerance_rel))
assert( error_rel < tolerance_rel )
+
+# Check relative L-infinity spatial norm of rho/epsilon_0 - div(E) when
+# current correction (psatd.do_current_correction=1) is applied
+if current_correction:
+ rho = data['rho' ].to_ndarray()
+ divE = data['divE'].to_ndarray()
+ Linf_norm = np.amax( np.abs( rho/epsilon_0 - divE ) ) / np.amax( np.abs( rho/epsilon_0 ) )
+ print("error: " + str(Linf_norm))
+ print("tolerance: 1.e-9")
+ assert( Linf_norm < 1.e-9 )