aboutsummaryrefslogtreecommitdiff
path: root/Examples/Tests/PML/analysis_pml_psatd.py
diff options
context:
space:
mode:
authorGravatar Edoardo Zoni <59625522+EZoni@users.noreply.github.com> 2020-02-27 11:17:56 -0800
committerGravatar GitHub <noreply@github.com> 2020-02-27 11:17:56 -0800
commit51e866e9a3f450d7767df97b0a2011cf65857c7a (patch)
treedd92e1108085a6d5f43039691cc39884230a7fb7 /Examples/Tests/PML/analysis_pml_psatd.py
parent6b345e38a9e312f2352c13b1e8e58399944d2798 (diff)
downloadWarpX-51e866e9a3f450d7767df97b0a2011cf65857c7a.tar.gz
WarpX-51e866e9a3f450d7767df97b0a2011cf65857c7a.tar.zst
WarpX-51e866e9a3f450d7767df97b0a2011cf65857c7a.zip
Implement div(E) diagnostics for spectral case (#720)
* Implement div(E) diagnostics for spectral case. * split travis tests in bigger matrix * split more TravisCI tests, add electrostatic, use defaults values * typo * Move computation of div(E) to base class SpectralBaseAlgorithm. * need to split psatd too * consistent variable names and use function to avoid duplication * fix typo for qed tests * typo * also need to update run_tests.sg * Update copyright tags. * change matrix * Add test of div(E) vs rho/epsilon_0 in PML test. * SpectralFieldIndex: reuse memory slot for Bx when computing divE. Co-authored-by: MaxThevenet <mthevenet@lbl.gov>
Diffstat (limited to 'Examples/Tests/PML/analysis_pml_psatd.py')
-rwxr-xr-xExamples/Tests/PML/analysis_pml_psatd.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Examples/Tests/PML/analysis_pml_psatd.py b/Examples/Tests/PML/analysis_pml_psatd.py
index 164c7a19e..3e5bcef04 100755
--- a/Examples/Tests/PML/analysis_pml_psatd.py
+++ b/Examples/Tests/PML/analysis_pml_psatd.py
@@ -31,6 +31,8 @@ Bz = all_data_level_0['boxlib', 'Bz'].v.squeeze()
Ex = all_data_level_0['boxlib', 'Ex'].v.squeeze()
Ey = all_data_level_0['boxlib', 'Ey'].v.squeeze()
Ez = all_data_level_0['boxlib', 'Ez'].v.squeeze()
+rho = all_data_level_0['boxlib','rho'].v.squeeze()
+divE = all_data_level_0['boxlib','divE'].v.squeeze()
energyE = np.sum(scc.epsilon_0/2*(Ex**2+Ey**2+Ez**2))
energyB = np.sum(1./scc.mu_0/2*(Bx**2+By**2+Bz**2))
energy_end = energyE + energyB
@@ -43,3 +45,6 @@ print("Reflectivity_theory: %s" %Reflectivity_theory)
assert( abs(Reflectivity-Reflectivity_theory) < 5./100 * Reflectivity_theory )
+# Check relative L-infinity spatial norm of rho/epsilon_0 - div(E)
+Linf_norm = np.amax( np.abs( rho/scc.epsilon_0 - divE ) ) / np.amax( np.abs( rho/scc.epsilon_0 ) )
+assert( Linf_norm < 2.e-2 )