Skip to content

Commit c7ce915

Browse files
committed
Fix CI Tests for Langmuir_multi_1d/psatd
1 parent 275cb89 commit c7ce915

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

Examples/Tests/Langmuir/analysis_langmuir_multi.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019 Jean-Luc Vay, Maxence Thevenet, Remi Lehe
3+
# Copyright 2019-2022 Jean-Luc Vay, Maxence Thevenet, Remi Lehe, Axel Huebl
44
#
55
#
66
# This file is part of WarpX.
@@ -13,6 +13,7 @@
1313
# $$ E_x = \epsilon \,\frac{m_e c^2 k_x}{q_e}\sin(k_x x)\cos(k_y y)\cos(k_z z)\sin( \omega_p t)$$
1414
# $$ 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)$$
1515
# $$ 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)$$
16+
import os
1617
import re
1718
import sys
1819

@@ -23,7 +24,6 @@
2324
import yt
2425

2526
yt.funcs.mylog.setLevel(50)
26-
import os
2727

2828
import numpy as np
2929
from scipy.constants import c, e, epsilon_0, m_e
@@ -151,8 +151,8 @@ def get_theoretical_field( field, t ):
151151
assert( error_rel < tolerance )
152152

153153
if div_cleaning:
154-
ds_old = yt.load('Langmuir_multi_psatd_div_cleaning_plt00038')
155-
ds_mid = yt.load('Langmuir_multi_psatd_div_cleaning_plt00039')
154+
ds_old = yt.load('Langmuir_multi_psatd_div_cleaning_plt000038')
155+
ds_mid = yt.load('Langmuir_multi_psatd_div_cleaning_plt000039')
156156
ds_new = yt.load(fn) # this is the last plotfile
157157

158158
ad_old = ds_old.covering_grid(level = 0, left_edge = ds_old.domain_left_edge, dims = ds_old.domain_dimensions)

Examples/Tests/Langmuir/analysis_langmuir_multi_1d.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python3
22

3-
# Copyright 2019-2021 Jean-Luc Vay, Maxence Thevenet, Remi Lehe, Prabhat Kumar
3+
# Copyright 2019-2022 Jean-Luc Vay, Maxence Thevenet, Remi Lehe, Prabhat Kumar, Axel Huebl
44
#
55
#
66
# This file is part of WarpX.
@@ -11,6 +11,7 @@
1111
# the script `inputs.multi.rt`. This simulates a 1D periodic plasma wave.
1212
# The electric field in the simulation is given (in theory) by:
1313
# $$ E_z = \epsilon \,\frac{m_e c^2 k_z}{q_e}\sin(k_z z)\sin( \omega_p t)$$
14+
import os
1415
import re
1516
import sys
1617

@@ -21,6 +22,7 @@
2122
import yt
2223

2324
yt.funcs.mylog.setLevel(50)
25+
2426
import numpy as np
2527
from scipy.constants import c, e, epsilon_0, m_e
2628

@@ -75,7 +77,7 @@ def get_theoretical_field( field, t ):
7577
# Check the validity of the fields
7678
error_rel = 0
7779
for field in ['Ez']:
78-
E_sim = data[field].to_ndarray()[:,0,0]
80+
E_sim = data[('mesh',field)].to_ndarray()[:,0,0]
7981
E_th = get_theoretical_field(field, t0)
8082
max_error = abs(E_sim-E_th).max()/abs(E_th).max()
8183
print('%s: Max error: %.2e' %(field,max_error))
@@ -104,14 +106,14 @@ def get_theoretical_field( field, t ):
104106
# current correction (psatd.do_current_correction=1) is applied or when
105107
# Vay current deposition (algo.current_deposition=vay) is used
106108
if current_correction or vay_deposition:
107-
rho = data['rho' ].to_ndarray()
108-
divE = data['divE'].to_ndarray()
109+
rho = data[('boxlib','rho')].to_ndarray()
110+
divE = data[('boxlib','divE')].to_ndarray()
109111
error_rel = np.amax( np.abs( divE - rho/epsilon_0 ) ) / np.amax( np.abs( rho/epsilon_0 ) )
110112
tolerance = 1.e-9
111113
print("Check charge conservation:")
112114
print("error_rel = {}".format(error_rel))
113115
print("tolerance = {}".format(tolerance))
114116
assert( error_rel < tolerance )
115117

116-
test_name = fn[:-9] # Could also be os.path.split(os.getcwd())[1]
118+
test_name = os.path.split(os.getcwd())[1]
117119
checksumAPI.evaluate_checksum(test_name, fn)

0 commit comments

Comments
 (0)