Skip to content

Commit c2b87b8

Browse files
updated multiple EBs CI test to have proper resolution (#117)
* new two embedded cylinders test with proper resolution * changed pytest parameter boxed to forked and updated changelog
1 parent dd565a8 commit c2b87b8

File tree

6 files changed

+32
-17
lines changed

6 files changed

+32
-17
lines changed

mewarpx/changelog.csv

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
Version, Physics version, Date, List of changes
2-
2.0.7, 2, In progress, "
2+
2.0.8, 2, In progress, "
3+
4+
**Other changes**:
5+
6+
- Changed ``pytest`` parameter ``boxed`` to ``forked`` due to deprecation in
7+
new versions.
8+
- Added ``positron`` as an 'inert gas' option in
9+
:class:`mewarpx.setups_store.diode_setup.DiodeRun_V1` in order to have 'ions'
10+
with dynamics that match the electrons.
11+
- Changed resolution for ``test_two_embedded_cylinders_scraping`` CI test since
12+
it was found that the previous test had overflows in the fieldsolve which
13+
probably caused the differences in results on different machines.
14+
"
15+
2.0.7, 2, 12/10/2021, "
316

417
**Other changes**:
518

mewarpx/mewarpx/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# One and only one place to store the version info
22
# https://stackoverflow.com/questions/458550/standard-way-to-embed-version-into-python-package
3-
__version_info__ = (2, 0, 7)
3+
__version_info__ = (2, 0, 8)
44
__version__ = '.'.join([str(x) for x in __version_info__])
55

66
# One and only one place to store the Physics version

mewarpx/mewarpx/setups_store/diode_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ def init_electrons(self):
399399

400400
def init_inert_gas(self):
401401
logger.info("### Init Inert Gas Ions ###")
402-
if self.INERT_GAS_TYPE not in ['He', 'Ar', 'Xe']:
402+
if self.INERT_GAS_TYPE not in ['He', 'Ar', 'Xe', 'positron']:
403403
raise NotImplementedError(
404404
f"Inert gas is not yet implemented in mewarpx with "
405405
f"INERT_GAS_TYPE = {self.INERT_GAS_TYPE}"

mewarpx/pytest.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ junit_family=xunit2
66
# used, because MEWarpX is not designed to reset gracefully between tests.
77
# Finally, note that conftest.py can dynamically change command line arguments,
88
# but this seems to break with pytest-xdist so cannot be used here.
9-
addopts = --boxed -n2
9+
addopts = --forked -n2
1010

1111
# Warnings: In the past -Werror was used in addopts above. Recent changes to
1212
# pytest cause harmless import warnings to make pytest fail on import. In order

mewarpx/tests/test_assemblies.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_two_embedded_cylinders_scraping():
271271
np.random.seed(42147820)
272272

273273
# Specific numbers match older run for consistency
274-
D_CA = 1 # m
274+
D_CA = 0.025 # m
275275
NX = 64
276276
NZ = 64
277277
run = diode_setup.DiodeRun_V1(
@@ -282,10 +282,12 @@ def test_two_embedded_cylinders_scraping():
282282
NZ=NZ,
283283
# This gives equal spacing in x & z
284284
PERIOD=D_CA * NX / NZ,
285-
DT=1e-9,
286-
TOTAL_TIMESTEPS=4,
287-
DIAG_STEPS=4,
285+
DT=1e-10,
286+
TOTAL_TIMESTEPS=15,
287+
DIAG_STEPS=15,
288288
FIELD_DIAG_DATA_LIST=['phi'],
289+
# FIELD_DIAG_PLOT=True,
290+
INERT_GAS_TYPE='positron'
289291
)
290292
# Only the functions we change from defaults are listed here
291293
run.setup_run(
@@ -302,12 +304,12 @@ def test_two_embedded_cylinders_scraping():
302304

303305
# Install the embedded boundaries
304306
cylinder1 = assemblies.Cylinder(
305-
center_x=-0.25, center_z=0.5, radius=0.1,
306-
V=-2.0, T=300, WF=4.7, name="Cylinder1"
307+
center_x=-0.25*D_CA, center_z=0.5*D_CA, radius=0.1*D_CA,
308+
V=-0.5, T=300, WF=4.7, name="Cylinder1"
307309
)
308310
cylinder2 = assemblies.Cylinder(
309-
center_x=0.25, center_z=0.5, radius=0.1,
310-
V=5.0, T=300, WF=4.7, name="Cylinder2"
311+
center_x=0.25*D_CA, center_z=0.5*D_CA, radius=0.1*D_CA,
312+
V=0.2, T=300, WF=4.7, name="Cylinder2"
311313
)
312314

313315
# Initialize solver
@@ -318,11 +320,11 @@ def test_two_embedded_cylinders_scraping():
318320

319321
# Inject particles in the simulation
320322
volemitter = emission.ZSinDistributionVolumeEmitter(
321-
T=1550, zmin=0, zmax=run.D_CA,
323+
T=3000, zmin=0, zmax=run.D_CA,
322324
)
323325
emission.PlasmaInjector(
324326
emitter=volemitter, species1=run.electrons, species2=run.ions,
325-
npart=2000, plasma_density=1e19,
327+
npart=4000, plasma_density=1e14,
326328
)
327329

328330
# Initialize the simulation
@@ -341,12 +343,12 @@ def test_two_embedded_cylinders_scraping():
341343
cylinder1.record_scrapedparticles()
342344
cyl1_scraped = cylinder1.get_scrapedparticles()
343345

344-
cylinder2.init_scrapedparticles(cylinder1.fields)
346+
cylinder2.init_scrapedparticles(cylinder2.fields)
345347
cylinder2.record_scrapedparticles()
346348
cyl2_scraped = cylinder2.get_scrapedparticles()
347349

348-
assert np.allclose(cyl1_scraped['n'], np.array([2, 40]))
349-
assert np.allclose(cyl2_scraped['n'], np.array([5, 46]))
350+
assert np.allclose(cyl1_scraped['n'], np.array([3, 0]))
351+
assert np.allclose(cyl2_scraped['n'], np.array([1, 2]))
350352

351353
#######################################################################
352354
# Check rho results against reference data #
Binary file not shown.

0 commit comments

Comments
 (0)