aboutsummaryrefslogtreecommitdiff
path: root/Python (follow)
AgeCommit message (Collapse)AuthorFilesLines
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>
2021-12-19For Python inputs, values with temporary variables are wrapped in quotes (#2690)Gravatar David Grote 1-4/+8
2021-12-16added RZ support in libwarpx function _get_boundary_number (#2680)Gravatar Roelof Groenewald 1-1/+3
2021-12-16Wrap shared object in a class to control its loading (#2637)Gravatar David Grote 8-507/+534
* Wrap shared object in a class to control its loading * Fix libwarpx attribute references * Updated callbacks.py for updated libwarpx * Removed the wx module plus other clean up * Further revision of how to use the pywarpx module. Now, _libwarpx should not be imported by external scripts except in special circumstances. * Updated documentation * Clean up end of line whitespace * Added more wrapping routines plus some clean up * Fixed use of pywarpx in two examples * Fix for getistep * Fixed for the EB Python interface * Silence a warning for our wrapper Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-12-16Adding new inputs to picmi.ElectromagneticSolver (#2676)Gravatar Lorenzo Giacomel 1-0/+8
2021-12-13Adding EB multifabs to the Python interface (#2647)Gravatar Lorenzo Giacomel 2-0/+187
* Adding edge_lengths and face_areas to the Python interface * Added wrappers for the two new arrays of data * Adding a CI test * Fixed test name * Added customRunCmd * Added mpi in test
2021-12-10Python/setup.py: picmistandard==0.0.18Gravatar Axel Huebl 1-1/+1
Forgotten in #2593
2021-12-091D tests for plasma acceleration (#2593)Gravatar Prabhat Kumar 1-0/+51
* modify requirements.txt and add input file for 1D Python pwfa * add 1D Python plasma acceleration test to CI * picmi version * USE_PSATD=OFF for 1D * Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Regression/WarpX-tests.ini Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Cartesian1D class in pywarpx/picmi.py * requirements.txt: update picmistandard * update picmi version * requirements.txt: revert unintended changes * 1D Laser Acceleration Test * Update Examples/Physics_applications/laser_acceleration/inputs_1d Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Examples/Physics_applications/plasma_acceleration/PICMI_inputs_plasma_acceleration_1d.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * add data_list to PICMI laser_acceleration test * increase max steps and fix bug in pywarpx/picmi.py 1DCartesian moving window direction * add data_lust to Python laser acceleration test * picmistandard update Co-authored-by: Prabhat Kumar <prabhatkumar@kraken.dhcp.lbl.gov> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-12-08Added 1D support to fields.py (#2634)Gravatar Roelof Groenewald 1-264/+183
* added _getitem1d and _setitem1d to fields.py * refactored fields.py to reduce duplicate code for different dimensions * fixed some bugs with the refactor * changes requested during code review
2021-12-02Release 21.12 (#2614)Gravatar Axel Huebl 1-1/+1
* AMReX: 21.12 * PICSAR: 21.12 * WarpX: 21.12
2021-11-30Fix segfault when importing _libwarpx without initializing WarpX (#2580)Gravatar Kevin Z. Zhu 1-2/+8
* Added check for if warpx was initialized when calling finalize * Renamed to be warpx_initialized * Fixed reference to global variable Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com> * Changed global variable to member of libwarpx * Fixed syntax errors * Remove custom arg from argv to avoid parmparse error Co-authored-by: Peter Scherpelz <31747262+peterscherpelz@users.noreply.github.com>
2021-11-22Python: Start 1D Support (#2582)Gravatar Axel Huebl 2-3/+10
* Python: Start 1D Support Start supporting 1D builds in Python. * Fix 1D: PML FillZero unused ... since PMLs are not yet supported in 1D. * BeamRelevant: Fix unused p_pos0 * FromTXYEFileLaserProfile: Not Impl in 1D * QED Schwinger: 1D not Implemented Fix unused warnings, add aborts. * 1D RealVect/IntVect: Initialization Use explicit scalar constructors, no braces. Fix warning in clang 10. * 1D NCI Filter: Fix unused members & Init Unimplemented, but throws warnings. * PSATD: 1D not Implemented - remove compile warnings - start porting some parts * NCIGodfreyFilter: Clean up 2D & Else
2021-11-20Python: More Nullptr Checks (#2574)Gravatar Axel Huebl 1-0/+18
* Python: More Nullptr Checks I am debugging a couple of crashes while mitigating CI. One of them pointed to the locations here (`ValueError: NULL pointer access`), so I decided to add some checks. * Skip invalid tiles * Skip Empty Tiles But Check Pointer * Python: nullptr check in _array1d_from_pointer Make the methods `get_particle_structs` and `get_particle_boundary_buffer_structs` more robust.
2021-11-08Install pre-commit (#2532)Gravatar Axel Huebl 6-6/+0
* Add pre-commit Add basis for automated pre-commit checks. Install locally via: ```bash python3 -m pip install -U pre-commit pre-commit install ``` See: https://pre-commit.com * Cleanup: Whitespaces * Cleanup: requirements.txt order
2021-11-05added wrappers to get particle structs for the particles in the boundary ↵Gravatar Roelof Groenewald 1-0/+46
buffers (#2498)
2021-11-05PICMI: Add max_grid_size, blocking_factor in (x,y,z) (#2524)Gravatar Edoardo Zoni 1-0/+28
* PICMI: Add amr.max_grid_size_<x,y,z> * Set All Flags in Python * PICMI: Add amr.blocking_factor_<x,y,z>
2021-11-05Add Python Wrappers for F,G in PML (#2481)Gravatar Edoardo Zoni 2-0/+259
* Add Python Wrappers for F,G in PML * Add Getters for F,G Nodal Flags * Fix Bug in <F,G>FPPMLWrapper (Default Level) * Fix Bug in F,G Nodal Flags * Use GetPML Method for F,G Nodal Flags
2021-11-02Change regex string to raw string (#2519)Gravatar Kevin Z. Zhu 1-1/+1
2021-11-02Release 21.11 (#2518)Gravatar Axel Huebl 1-1/+1
* Update: AMReX/PICSAR to 21.11 AMReX is a post 21.11 release, due to a needed bugfix in compGrad with EB that landed 4hrs after release. * WarpX: 21.11
2021-10-29Add option to specificy absolute tolerance for the MLMG solver (#2410)Gravatar Roelof Groenewald 1-0/+5
* added option to specify absolute tolerance for the MLMG solver used in the electrostatic field solve * added absolute tolerance argument to the documentation * fixed bug introduced during copy and paste * expanded documentation for MLMG solver absolute tolerance (added unit) and added a link to the AMReX documentation describing the MLMG solver parameters * possibly more robust handling of the MLMG convergence * switched from std::max to amrex::max to hopefully fix compiler complaints * updated checksum values for MCC test (background_mcc); the values changed only slightly, presumably due to a difference in the initial field solve which would now have the absolute tolerance value included, but since the Python version of this same test (which uses the direct solver) still passes the change is assumed to be inconsequential * another try to fix the compile issues * print a message to notify user if the max norm of rho is zero * Apply suggestions from code review Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * switched print statements to the new warning logger Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
2021-10-27More fixes for the Python fields module (#2502)Gravatar David Grote 1-60/+64
Fixed indexing for PML fields. Add all of the fixes to the setitems routines.
2021-10-25PICMI: Add PML div(E),div(B) Cleaning Options (#2480)Gravatar Edoardo Zoni 2-1/+4
2021-10-25Raise an exception if an MultiFab was not intialized (#2476)Gravatar David Grote 1-0/+9
2021-10-25Fix Bug with Python Wrappers for F,G (#2474)Gravatar Edoardo Zoni 2-8/+8
2021-10-23PICMI: Add div(E),div(B) Cleaning Options (#2477)Gravatar Edoardo Zoni 2-1/+3
* PICMI: Add div(E),div(B) Cleaning Options * Update PICMI Version: 0.0.15
2021-10-22Fix fields indexing (#2469)Gravatar David Grote 1-30/+31
* Fix fields indexing * Added additional documentation * Fixed comment
2021-10-21Add Python Wrappers for F,G (#2460)Gravatar Edoardo Zoni 2-0/+240
2021-10-18Use os.path.join in picmi.py for portability (#2400)Gravatar Andrew Myers 1-4/+5
* Use os.path.join in picmi.py for portability * Apply suggestions from code review
2021-10-15CI: Windows with Python (#2412)Gravatar Axel Huebl 1-1/+6
* Python: generalize library search (Win) * CMake: Honor Multi-Config Lib Alias For multi-config build generators (MSVC, Ninja opt-in), we have a deeper build structure based on the build type. Honor this structure for the (Python) library alias/symlink. * CI: Windows with Python Co-authored-by: Dave Grote <dpgrote@lbl.gov>
2021-10-08Fix checkpoint with runtime components through the Python interface. (#2332)Gravatar Andrew Myers 1-0/+5
* add component names to checkpoint * read in particle components and add the missing ones on restart * do not add components if one by the name already exists * sign error * Better warning messages * Update Source/Diagnostics/ParticleIO.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * add CI test for restarting particles with runtime-added attributes * remove unused module Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-10-07Remove unused fftw_plan_measure parameter (#2387)Gravatar Neïl Zaim 1-2/+0
2021-10-04Release 21.10 (#2370)Gravatar Axel Huebl 1-1/+1
* Update: AMReX/PICSAR to 21.10 * WarpX: 21.10
2021-09-24Stochastic particle reflection from absorbing domain boundaries (#2281)Gravatar Roelof Groenewald 1-0/+19
* added tunable particle reflection from absorbing domain boundaries * extended picmi.py to allow setting boundary reflection coefficients and added a CI test for the reflection implementation * allow R(E) to be specified, except for embedded boundaries * changed approach for particle reflection, now the ParticleBoundaries object will hold the reflection coefficient; reflection from EBs not implemented * added functionality to reflect from EB; still needs to be tested for accuracy * added support for energy dependent reflection models for domain boundaries * fixed at least one issue causing CI fails - building reflection model parsers for not physical particle containers * switched reflection coefficients to be functions of the velocity component perpendicular to the boundary rather than energy * reverted initial work on reflecting from EBs * changed naming convention for new CI test for particle reflection * switched useMPI back to 1 in test * breaking changes while trying to sort out GPU issue * fixed issue with CUDA compilation - hopefully :) * various code improvements from PR review suggestions * fix of major issues * no need to parse the reflection models at every step * skip particles that are already flagged for removal in ApplyBoundaryConditions