diff options
author | 2021-12-23 09:54:00 -0700 | |
---|---|---|
committer | 2021-12-23 16:54:00 +0000 | |
commit | 3f6192c4922023811417a4c998bc0433f880dbca (patch) | |
tree | 9dc343577865c903cfc962388c3d6d5153ce3ab4 /Examples/Tests/scraping/analysis_rz.py | |
parent | 549d8a0a89f6d9c40444acdc7d11f16d5a87858f (diff) | |
download | WarpX-3f6192c4922023811417a4c998bc0433f880dbca.tar.gz WarpX-3f6192c4922023811417a4c998bc0433f880dbca.tar.zst WarpX-3f6192c4922023811417a4c998bc0433f880dbca.zip |
Test particle scraping for EB in RZ. (#2691)
* Modify WarpXFaceExtensions.cpp and WarpXInitEB.cpp.
* Remove an assertion.
* Update particle scraping for RZ
* Apply suggestions from code review
* Add automated test.
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Fix CI issues
* Change permissions
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'Examples/Tests/scraping/analysis_rz.py')
-rwxr-xr-x | Examples/Tests/scraping/analysis_rz.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Examples/Tests/scraping/analysis_rz.py b/Examples/Tests/scraping/analysis_rz.py new file mode 100755 index 000000000..6c493fb0f --- /dev/null +++ b/Examples/Tests/scraping/analysis_rz.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +# Copyright 2019-2021 Yinjian Zhao +# +# This file is part of WarpX. +# +# License: BSD-3-Clause-LBNL + +# This script tests the particle scraping for the embedded boundary in RZ. +# Particles are initialized between r=0.15 and r=0.2 +# having a negative radial velocity. +# A cylindrical embedded surface is placed at r=0.1. +# Upon reaching the surface, particles should be removed. +# At the end of the simulation, i.e., at time step 37, +# there should be 512 particles left. + +# Possible errors: 0 +# tolerance: 0 +# Possible running time: < 1 s + +import os +import sys + +import yt + +sys.path.insert(1, '../../../../warpx/Regression/Checksum/') +import checksumAPI + +tolerance = 0 + +fn = sys.argv[1] +ds = yt.load( fn ) +ad = ds.all_data() +x = ad['electron', 'particle_position_x'].v + +error = len(x)-512 +print('error = ', error) +print('tolerance = ', tolerance) +assert(error==tolerance) + +test_name = os.path.split(os.getcwd())[1] +checksumAPI.evaluate_checksum(test_name, fn, do_particles=False) |