Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Feb 27, 2024
1 parent 9a653a8 commit 2781641
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
# --- of one electron on the surface of a sphere.

import argparse

import numpy as np

from pywarpx import callbacks, particle_containers, picmi

# Create the parser and add the argument
Expand Down Expand Up @@ -117,7 +119,7 @@ def mirror_reflection():
buffer = particle_containers.ParticleBoundaryBufferWrapper()
if (buffer.get_particle_boundary_buffer_size("electrons", 'eb', False)>0): #otherwise np.concatenate doesnt work
delta_t = np.concatenate(buffer.get_particle_boundary_buffer("electrons", 'eb', 'deltaTimeScraped', 0))

#step 1: extract the different parameters of the scraping buffer (normal, time, position)
r = np.concatenate(buffer.get_particle_boundary_buffer("electrons", 'eb', 'x', 0))
theta = np.concatenate(buffer.get_particle_boundary_buffer("electrons", 'eb', 'theta', 0))
Expand All @@ -134,12 +136,12 @@ def mirror_reflection():

#step 2: use these parameters to inject from the same position electrons in the plasma
elect_pc = particle_containers.ParticleContainerWrapper('electrons')
un=ux*nx+uy*ny+uz*nz
un=ux*nx+uy*ny+uz*nz
ux_reflect=-2*un*nx+ux #for a "mirror reflection" u(sym)=-2(u.n)n+u
uy_reflect=-2*un*ny+uy
uz_reflect=-2*un*nz+uz
elect_pc.add_particles(
x=x + (dt-delta_t)*ux_reflect, y=y + (dt-delta_t)*uy_reflect, z=z + (dt-delta_t)*uz_reflect, ux=ux_reflect, uy=uy_reflect, uz=uz_reflect,
x=x + (dt-delta_t)*ux_reflect, y=y + (dt-delta_t)*uy_reflect, z=z + (dt-delta_t)*uz_reflect, ux=ux_reflect, uy=uy_reflect, uz=uz_reflect,
w=w,
unique_particles=args.unique
)
Expand Down
2 changes: 1 addition & 1 deletion Examples/Tests/particle_boundary_interaction/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
This script tests the last coordinate after adding an electron.
The sphere is centered on O and has a radius of 0.2 (EB)
The electron is initially at: (0,0,-0.25) and moves with a velocity:
The electron is initially at: (0,0,-0.25) and moves with a velocity:
(0.5e10,0,1.0e10) with a time step of 1e-11.
An input file PICMI_inputs_rz.py is used.
"""
Expand Down
2 changes: 1 addition & 1 deletion Regression/WarpX-tests.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4683,6 +4683,6 @@ numthreads = 1
compileTest = 0
doVis = 0
compareParticles = 1
particleTypes = electrons
particleTypes = electrons
outputFile = particle_boundary_interaction_plt
analysisRoutine = Examples/Tests/particle_boundary_interaction/analysis.py

0 comments on commit 2781641

Please sign in to comment.