Comments (7)
@jwestern thanks for bringing this up!
To clarify, the particle diagnostic outputs ParticleContainerWrapper
actually takes (or gives) u
in the code it is really
Do you have a suggestion for specific documentation sections that could be improved to prevent a future user from having the same difficulty? Would you be willing to open a PR to improve the documentation in this regard?
from warpx.
@roelof-groenewald thanks for the quick reply. Once I'm convinced of what's correct, I can open a PR.
Are you sure about the particle diagnostic output? When I read particle diagnostic data into Python to inspect its values (particles which were created using ParticleContainerWrapper
and feeding it
from warpx.
I should've clarified - are you using plotfile
output or openpmd
as the output format? The comment I made applies to openpmd
output. I'm not sure about the output for plotfile
.
Using openpmd
output I generally do the following:
from openpmd_viewer import OpenPMDTimeSeries
from scipy import constants
ts_parts = OpenPMDTimeSeries('diags/particles')
ux, uy, uz = ts_parts.get_particle(
var_list=['ux', 'uy', 'uz'],
species=<species>, iteration=<it>
)
vx = ux*constants.c
vy = uy*constants.c
vz = uz*constants.c
which gives me expected velocity values in m/s.
from warpx.
I'm using openPMD h5 files, such as openpmd_001000.h5 for example. They are created using
picmi.ParticleDiagnostic(write_dir = f'./diags/test_run',
warpx_file_prefix = 'particle',
period=25,
species=<species_list>,
warpx_openpmd_backend='h5',
warpx_format='openpmd',
data_list=['x', 'y', 'z', 'ux', 'uy', 'uz', 'weighting'])
and then I read it in using h5py
like so:
import h5py as h5
from scipy import constants
file = h5.File('openpmd_001000.h5','r')
ux = file['data/1000/particles/electrons/momentum/x'][:]
uy = file['data/1000/particles/electrons/momentum/y'][:]
uz = file['data/1000/particles/electrons/momentum/z'][:]
v = <v> # my expected velocity in m/s
gam = 1./np.sqrt(1-(v/constants.c)**2)
print(ux / constants.m_e / v / gam)
and the result is exactly 1.
from warpx.
Oh, okay I see what is happening. The momentum
key in the hdf5 output does store momentum, as you have found. If instead you use the openpmd_viewer
API to query u{x/y/z}
it will internally convert the momentum to
Now I also learned something new. Thanks!
So does that clear up your questions as well?
from warpx.
Yes, thanks. I guess it's hard to warn people about the particle diagnostic data when different tools give different results. But one could reasonably expect a user to check the values of what they're reading in.
On the other hand, in my view the documentation for the add_particles
method of ParticleContainerWrapper
ought not to simply say "momenta," but rather "momenta per unit mass" or "specific momenta" or give the formula
from warpx.
No, such a change would not be too trivial for a PR since it can definitely help clarify things for other users. I think it would be best to modify the documentation to say the function takes in the "proper velocity".
Thanks for be willing to improve the documentation!
from warpx.
Related Issues (20)
- CUDA initialization failed HOT 5
- CMake: Finalize WarpX/ABLASTR Installer HOT 2
- CI: CUDA RZ PSATD
- NERSC Perlmutter Compilation Error (pre-#4986) HOT 3
- Error recompiling on Lassen HOT 3
- Some basic AMR questions`1 HOT 2
- Adios2 using Blosc2 HOT 3
- Poor scaling to multiple GPUs with electrostatic solver HOT 5
- PICMI documentation is gone HOT 4
- Issue with Limiting External Electric Field to Specific Boundary in 3D Simulation HOT 8
- Clean code: remove `tmp_particle_data`
- Bug: Invalid memory access occurred during AMReX::GpuDevice::streamSynchronize HOT 10
- Convergence behavior of electrostatic solver changes whether embedded boundary support is on or off HOT 1
- Cannot get FFT method to work for electrostatic solver HOT 4
- NumPy 2.0 Compatibility HOT 5
- Runtime error with Laser Ion acceleration test run HOT 2
- Clean code: avoid duplication in Source/Parallelization/WarpXComm.cpp
- Segfault converting SOA particles to conduit blueprint
- How to utilize WarpX to investigate the evolution of relativistic electron beams in vacuum HOT 2
- Laser injected at an angle having non-physical effects HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from warpx.