aboutsummaryrefslogtreecommitdiff
path: root/Python (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-10-24Add reduced diagnostics to `picmi.py` (#3475)Gravatar Roelof Groenewald 4-57/+184
* add reduced diagnostics to picmi * added test of picmi reduced diagnostics * changes requested during PR review
2022-10-10Add functions for reading particle id and cpu numbers correctly (#3457)Gravatar Andrew Myers 1-9/+24
2022-10-03Release 22.10 (#3444)Gravatar Axel Huebl 1-1/+1
* AMReX: Weekly Update One commit after 22.10 release, to fix oneAPI DPC++ 2022.02: 22.10-1-g13aa4df0f5 * PICSAR: 22.10 * WarpX: 22.10
2022-10-02Major update of the Python/picmi documentation (#3329)Gravatar David Grote 3-29/+534
* Include WarpX specific documentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Undo the precommit change of import in __init__.py * Docs: Install Pure Python WarpX PICMI Allows to use these classes in our Sphinx autodocs in the manual. * Sphinx: Add Napoleon Extension https://sphinxcontrib-napoleon.readthedocs.io * PICMI Doc Strings: Fix Some Warnings * Removed the DocumentedMetaClass since it was moved to picmistandard * Defined the languate in Docs/source/conf.py * Cleaned up minor issues in the rst files * Updated existing doc strings in picmi.py * Reformatted doc strings in Regression/Checksum/checksumAPI.py * Reformatted doc strings in Regression/Checksum * First set of WarpX specific documentation * Updated to picmistandard version 0.0.20 * Cleaned up the Python document page Fixed up the text to be more clear. Added section headers for each picmi class (for easy reference). * Further updates to picmi.py doc strings Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-09-29Add 1d support to `_libwarpx.py` functions `get_particle_X` (#3421)Gravatar Roelof Groenewald 1-5/+11
* add 1d support to _libwarpx.py functions `get_particle_X` * add coverage of 1d `_libwarpx.get_particle_z` to test suite
2022-09-02Release 22.09 (#3365)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.09 * PICSAR: 22.09 * WarpX: 22.09
2022-08-29Python: 3.7+ (#3342)Gravatar Axel Huebl 1-1/+1
* Python: 3.7+ Python 3.6 is now end-of-life. Bump support to 3.7+. * CUDA CI: Python3 Update
2022-08-28Docs: Add description of Python APIs in `libwarpx` (#3310)Gravatar Roelof Groenewald 2-97/+170
* add mention of callbacks and some libwarpx functions to the docs * reformatted various function docstrings in `_libwarpx.py` and added them to the docs * Add subsection Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-08-11`isort`: AMReX, WarpX, etc. as First Party (#3307)Gravatar Axel Huebl 2-1/+3
* `isort`: AMReX, WarpX, etc. as First Party Mark the `amrex` and `pywarpx`, `picmistandard`, ... imports as first party, so that they do not change if run locally or remotely pre/post install.
2022-08-10Initialize particle runtime attributes inside AddNParticles (#3272)Gravatar Neïl Zaim 1-1/+6
* Initialize particle runtime attributes before calling AddNParticles * Avoid Multiplication result converted to larger type warning * Directly initialize runtime attributes inside AddNParticles * Update doxygen comment
2022-08-08PICMI: Fix Bug in Class `Species` Init (#3286)Gravatar Edoardo Zoni 1-17/+20
2022-08-01Release 22.08 (#3276)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.08 * PICSAR: 22.08 * WarpX: 22.08
2022-07-22Add Python Callback Call when Checkpointing Signal is Received (#3251)Gravatar Roelof Groenewald 1-0/+15
2022-07-09Release 22.07 (#3211)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.07 * PICSAR: 22.07 * WarpX: 22.07 * SENSEI: Update to 4.0.0 * AMReX: 22.07-4-gcbdc6580ee Include SENSEI build fixes.
2022-07-07Parse the quantity `zmax_plasma_to_compute_max_step` in PICMI (#3217)Gravatar Remi Lehe 1-0/+3
* Parse the quantity `zmax_plasma_to_compute_max_step` * Apply review comments
2022-06-24Added `none` as an option for fields_to_plot (#2419)Gravatar David Grote 1-0/+2
* Added `none` as an option for fields_to_plot * Added CI test case * Further updates, for picmi and CI tests * Skip the call to amrex::WriteMultiLevelPlotfile when writing no fields * Now clears m_varnames_fields * Don't allocate m_mf_output if no varnames * Updated WarpX-tests.ini
2022-06-06Release 22.06 (#3161)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.06 * PICSAR: 22.06 * WarpX: 22.06
2022-05-24Specify particle precision (#3065)Gravatar Kevin Z. Zhu 1-13/+27
* Add precision to printed PIC parameters * Added WarpX_PARTICLE_PRECISION as a build option * Update types to ParticleReal * Updated libwarpx to inject particles with correct ParticleReal type * Fix syntax error * Add logic to avoid duplicate definitions * Use correct ParticleReal type in add_particles * Cleaned up code, addressed comments * Update Python/pywarpx/_libwarpx.py Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com> * Removed redundant functions, fixed some typing * Modified template functions * Cast d_w to Real * Fixed failing tests * Cast types to be consistent * removed in-tree-build from pip command * Added GPU device macros to PDim3 methods * rerun tests * Removed unecessary casting, update calls to use PDim3 instead of XDim3 * Refactored comments * Added mcc fields double precision, particles single precision test * Updated casting and formatting * Removed cast, updated declaration Co-authored-by: Peter Scherpelz <peter.scherpelz@modernelectron.com> Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com>
2022-05-16Add Headers to Input File Written by PICMI (#3093)Gravatar Edoardo Zoni 1-0/+12
* Add Headers to Input File Written by PICMI * Commit Suggestion by @dpgrote * Add Comment * Add Empty Line * Slightly Better Readable with a newline
2022-05-16Add STL files support in pywarpx (#3089)Gravatar Lorenzo Giacomel 4-11/+53
* Added STL files support in pywarpx * Add new EB bucket * Added name to file headers * Fixing year in file headers * Checking that stl file and imp function are not both specified * Renamed EB bucket to EB2 * Adding STL documentation * Implement suggestions from code review Co-authored-by: lgiacome <lorenzo.giacome@cern.ch>
2022-05-03Release 22.05 (#3076)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.05 * PICSAR: 22.05 * WarpX: 22.05 * Fix issue with RZ electrostatic solver Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
2022-04-19add after diagnostic python callback (#3043)Gravatar Roelof Groenewald 1-0/+17
2022-04-06Added PlasmaLens class to PICMI (#3025)Gravatar David Grote 1-3/+35
* Added PlasmaLens class to PICMI * Added CI test * Added PICMI input file * Fixed the output dir for the CI test * Add `_plt` to Output File Prefix Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
2022-04-02Allow process signals to trigger checkpoint or break behavior (#2896)Gravatar Phil Miller 1-0/+6
* Beginnings of signal handling machinery * Add tentative logic to make checkpoint call * Adapt formatting slightly * Add calls to read signals and set up signal handlers * Initialize signal flag array * Add parsing of signal names, and fix some whitespace issues * Skip signal setup on Windows * added checkpoint and break signal inputs to picmi.py * Address initial review requests * Correct comment to match changed code * Convert maximum signal number to a symbolic name * Always parse signal input, and error out on Windows or wherever it may be unsupported * Typo fix * Add missing reset of checkpoint signal flag * Add reset of break signal, in support of Python or library usage * Test for a configured checkpoint diag when asked to checkpoint on a signal * Fix typo in Linux code path * Clean up MPI support * Use symbolic name for maximum signal number * Fix unused variable in the no-MPI case * Add missing header inclusions * Switch signal parsing to an enumerated table * Test signal handling for Linux, not GNU C library * Avoid another magic number * Update MPI_Ibcast call to match symbolic array length * Update loop over signal flags to use symbolic limit * Match #includes to usage * Add omitted C++ std <atomic> header include * Guard entire set of signal definitions as *nix-only, not for Windows * Broaden Windows exclusion to avoid zero-length array that displeases MSVC++ * Check return value from sigaction() * Convert conditional calls to Abort() to assertions * Move check for platform support to input parsing * Shift signal handling code over toward ABLASTR to share with ImpactX and Hipace++ * Minor cleanup * A bit more cleanup * Fix formatting nits * Add AMReX error handling on MPI calls * Add ABLASTR signal handling code to GNU makefile too * Document new input parameters * Use ABLASTR assertion macros in ABLASTR code * Convert requests limit value to a requests array size * Generalize signal handling to an arbitrary set of potential actions * Rename class to match usage and file name * Stick stuff in ABLASTR namespace * Indent conditional includes as requested Co-authored-by: Roelof <roelof.groenewald@modernelectron.com>
2022-04-01Release 22.04 (#3018)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.04 * PICSAR: 22.04 * WarpX: 22.04
2022-03-29Add `propagation_direction` to PICMI lasers (#2992)Gravatar David Grote 1-0/+2
2022-03-17Removed used of separate bc arguments (#2977)Gravatar David Grote 1-22/+18
2022-03-09allow diagnostic data_list to be None (#2949)Gravatar Ryan Sandberg 1-88/+91
2022-03-07properly handle MCC collision subcycling (#2934)Gravatar Roelof Groenewald 1-1/+3
2022-03-03Rename `serialize_ics` as `serialize_initial_conditions` (#2925)Gravatar Edoardo Zoni 1-2/+2
* Rename `serialize_ics` as `serialize_initial_conditions` * Add Backward Compatibility Check
2022-03-03Release 22.03 (#2912)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.03 * PICSAR: 22.03 * WarpX: 22.03
2022-03-03PICMI: warpx_file_min_digits (#2914)Gravatar Axel Huebl 2-1/+13
Add for all diagnostics the equivalent of `<diag>.file_min_digits`.
2022-02-25Add Coulomb collision installation to picmi.py (#2864)Gravatar Roelof Groenewald 1-0/+21
* added Coulomb collision installation to picmi.py * added comment saying the input values for the new PICMI test comes from inputs_2d
2022-02-04added `local` flag to `warpx_getNumParticles` (#2828)Gravatar Roelof Groenewald 1-2/+4
2022-02-02Release 22.02 (#2820)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.02 * PICSAR: 22.02 * WarpX: 22.02
2022-02-01allow `add_particles` to be called with empty numpy arrays i.e. injecting ↵Gravatar Roelof Groenewald 1-5/+0
zero particles (#2808)
2022-01-26Add Python callbacks before and after collisions (#2791)Gravatar Roelof Groenewald 1-0/+30
* add python callbacks before and after collisions * re-order callback declarations
2022-01-26expose WarpXParticleContainer::sumParticleCharge to Python (#2790)Gravatar Roelof Groenewald 1-0/+17
2022-01-25Add SyncRho call to warpx_depositChargeDensity (#2777)Gravatar Roelof Groenewald 1-1/+9
* add SyncRho call to warpx_depositChargeDensity * expose SyncRho to Python; add warpx_clearChargeDensity to reset rho_fp before deposition * remove unneeded warpx_clearChargeDensity function * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * add (default) option to depositChargeDensity to call SyncRho after deposition * added option to depositChargeDensity to zero out rho_fp before deposition * code cleanup * import fields from inside depositChargeDensity Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-01-21Access species specific charge density from python (#2710)Gravatar Roelof Groenewald 1-0/+17
* added python wrapper function to deposit a specific species density in rho_fp * added 1D ES input file with MCC that uses the charge deposition functionality * reset rho_fp[lev] before depositing * updated documentation * switch to using simulation.extension in Poisson solver * Apply suggestion from code review Co-authored-by: Phil Miller <phil.miller@intensecomputing.com> * suggested changes from code review * add comment explaining why a direct Poisson solver is used * removed direct solver in 1D example since it is actually slower than the MLMG solver * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * added docstring for warpx_depositChargeDensity * fixed order of imports in new PICMI input file Co-authored-by: Phil Miller <phil.miller@intensecomputing.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-01-19Refactor python callback handling (#2703)Gravatar Roelof Groenewald 1-27/+38
* added support to uninstall an external Poisson solver and return to using the default MLMG solver; also updated some callbacks.py calls to Python3 * refactor callback handling - use a map to handle all the different callbacks * warpx_callback_py_map does not need to link to C * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * further suggested changes from code review * added function ExecutePythonCallback to reduce code duplication * moved ExecutePythonCallback to WarpX_py * added function IsPythonCallbackInstalled Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-01-18Python: Fix UB in Inputs Passing (#2726)Gravatar Axel Huebl 1-2/+7
Trying to fix the macOS PyPy 3.7 error seen in https://github.com/conda-forge/warpx-feedstock/issues/37 Testing in https://github.com/conda-forge/warpx-feedstock/pull/38 After googling for a while, the original implementation was likely based on https://code.activestate.com/lists/python-list/704158, which contains bugs. 1) Bug: `create_string_buffer` Allocating new, null-terminated char arrays with `ctypes.create_string_buffer` does lead to scrambled arrays in pypy3.7. As far as I can see, this [should have also worked](https://docs.python.org/3/library/ctypes.html), but maybe there is a bug in the upstream implementation or the original code created some kind of use-after-free on a temporary while the new implementation just shares the existing byte address. This leads to errors such as the ones here: https://github.com/conda-forge/warpx-feedstock/pull/38#issuecomment-1010160519 The call `argvC[i] = ctypes.c_char_p(enc_arg)` is equivalent in creating a `NULL`-terminated char array. 2) Bug: Last Argv Argument The last argument in the array of char arrays `argv` in ANSII C needs to be a plain `NULL` ptr. Before this PR, this has been allocated but never initialized, leading to undefined behavior (read as: crashes). Reference: https://stackoverflow.com/a/39096006/2719194 3) Cleanup: there is a pre-defined `ctypes.c_char_p` we can use for pointer of char.
2022-01-15Set geometry earlier in picmi (#2745)Gravatar David Grote 1-19/+28
* Set geometry earlier in Python * Fix comment typos
2022-01-12Make moving window dimensionality consistent in PICMI (#2721)Gravatar Prabhat Kumar 2-11/+11
* Make moving window dimensionality consistent in PICMI * update PICMI_inputs_plasma_acceleration_1d.py * two elements for moving window velocity in RZ * update RZ laser_acceration test * update PICMI version * update PICMI Langmuir RZ test
2022-01-11Sort the argument list that Python writes to the inputs files (#2732)Gravatar David Grote 1-4/+7
2022-01-04Allow Dirichlet BCs on r boundaries in RZ (electrostatic) (#2714)Gravatar Roelof Groenewald 2-6/+4
* allow Dirichlet BCs in r when r_min != 0 with ES RZ simulations * handle the rmax boundary condition setting properly when rmin == 0 * add ability to specify rmin and rmax potentials through picmi
2022-01-04Release 22.01 (#2718)Gravatar Axel Huebl 1-1/+1
* AMReX: 22.01 * PICSAR: 22.01 * WarpX: 22.01
2021-12-22Change _libwarpx.py functions to LibWarpX class methods (#2696)Gravatar Peter Scherpelz 6-1961/+1879
* Initial attempt at moving function into LibWarpX * Bugfix - undefined structs in get_particle_theta This is untested, identified by IDE/visual inspection only * Unify newlines * Delete libwarpx.clight (duplicated picmi.py) See picmi.constants.c * Change function descriptive comment to docstring Also remove extra newline in __init__ beginning. * Replace pywarpx/_libwarpx calls appropriately * Fix atexit register of finalize function * Reorder WarpX.py imports for pre-commit * Use picmi.Simulation.extension = libwarpx alias This will hopefully preempt user script changes if we restructure things to allow multiple WarpX runs to be done within a single Python script. * Fix libwarpx ref in WarpX.getProbLo/getProbHi * Update get_particle_boundary_buffer doc reference
2021-12-21pre-commit: Python imports (#2686)Gravatar Axel Huebl 12-31/+40
* pre-commit: Python imports Add two new Python rules to: - remove unused imports - sort imports according to PEP8 * pre-commit: Python imports Add two new Python rules to: - remove unused imports - sort imports according to PEP8 `.editorconfig`: isort options https://github.com/PyCQA/isort/wiki/isort-Settings * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * move import os (mpl) * move import yt (mpl) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Cleanup around matplotlib.use * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Cleaning: double np and lib Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2021-12-21Inputs: `geometry.dims` option (#2685)Gravatar Axel Huebl 2-9/+9
* Docs: `geometry.dims` option Add a new, required option to specify the geometry of an inputs file at runtime. * Check & Report Runtime Dims Mismatch * Examples: add `geometry.dims` * Deprecation Warning: `geometry.coord_sys` * PICMI: `geometry.dims` * Improve error message sounds a bit better * Improve Doc Description Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com> Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>