aboutsummaryrefslogtreecommitdiff
path: root/Python/pywarpx (follow)
AgeCommit message (Collapse)AuthorFilesLines
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 5-5/+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-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 1-0/+3
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 1-0/+2
* 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-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
2021-09-22External Poisson solver: wrappers to copy the full domain rho and phi ↵Gravatar Roelof Groenewald 2-8/+73
between C++ and Python (#2285) * added missing parts to allow an external Poisson solver to be used instead of the MLMG solver * added rho and phi wrappers to fields.py * added an example of using an external Poisson solver * need to run PICMI test on 2 processors same as non-PICMI version in order to compare plotfiles * changes requested during PR review * pass dictionary to eval statement when calculating boundary potential
2021-09-21Rename eb_potential parameter (#2310)Gravatar Remi Lehe 1-1/+1
2021-09-17Add picmi parameter (#2306)Gravatar Michael Kieburtz 1-1/+3
2021-09-10Various updates related to defining embedded boundaries in Python (#2280)Gravatar David Grote 2-22/+45
* Various updated related to defining embedded boundaries in Python * Fix typo in comment Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com>
2021-09-07Allow Restarts and Checkpoints in python picmi (#2274)Gravatar Nicholas Ruof 1-0/+30
* Add a class to output checkpoint diagnostics in picmi * Add argument to picmi Simulation for restarting from a checkpoint * Changes to make the checkpoint work * Change inheritance for Checkpoint and rename variables in Simulation * Remove file exists check
2021-08-30Make buffer of scraped particles available to Python code (#2164)Gravatar Phil Miller 2-0/+142
* Added wrapper to get number of particle species tracked by the scraper Not sure if this is going to be useful, but it demonstrates a method to get information from the ParticleBoundaryBuffer into Python. * Stubbed out the main wrapper functions * Added parameters to wrapper * Added wrapper for getting the number of particles scraped of a species on a boundary * added picmi arguments to scrape particles at the domain boundary * Added wrapper to get the full particle buffer into python * rearanged the getBuffer properties code a little * Added docstrings +other suggested changes * Added num_particles_impacted_boundary docstring * fixed mistake in docstring * Changed boundary parameter to be a string for clarity * Fixed issue with the boundary parameter for scraping * Fixed issue with the boundary input for scraping stats wrapper * Added demonstration of particle scraping wrapper * Added analysis.py file * Fix typo in one of the dimension maps Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> * Added before esolve to warpx evolve * added test for the scraped particle buffer wrappers * Moved python PICMI particle boundary scrape test * Renamed test file to the correct name * Removed old test * added special functionality to get the timestep at which particles were scraped * removed debug print * added python wrapper for the clearParticles() function of the scraper buffer * added special wrapper function to get the timesteps at which the particles in the boundary buffer were scraped * updated test to match the non-PICMI test for the particle scraper buffer * Fix uncaught rebase mistake * re-activated picmi test of accessing the scraped particle buffers via python * added documentation for the new parameters involved in the scraped particle buffer and fixed remaining issue with picmi test * changes requested during code review Co-authored-by: mkieburtz <michaelkieburtz@gmail.com> Co-authored-by: Roelof <roelof.groenewald@modernelectron.com> Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com>
2021-08-27Functionality to save particle positions from the previous step (#2206)Gravatar Roelof Groenewald 1-1/+3
* added functionality to save particle positions from the previous step * copied WarpX variable to local variable to fix issue with GPU and DPC++ compilation * switched to using a species attribute to toggle whether previous positions are saved so it can be turned on for only a subset of species if desired * changed variable name to be more verbose * added CI test of saving the previous particle positions * start of a table in the documentation to describe commonly used runtime attributes * generate test benchmark data from results obtained with a 2 processor run - the same as what is done during the test * relaxed tolerance on test * regenerate CI test reference data with USE_PSATD=TRUE * Update Docs/source/developers/particles.rst Co-authored-by: Phil Miller <unmobile+gh@gmail.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-08-26Improvement in electrostic field solve when using EB & a small refactoring ↵Gravatar Roelof Groenewald 1-1/+22
of the Electrostatic solver (#2143) * refactored parts of the electrostatic solver to allow an outside Poisson solver to be installed * added callback to install a Poisson solver that can be used instead of the MLMG solver * added call to the poissonsolver callback if one is installed and updated ElectrostaticSolver.cpp to calculate the electric field directly in amrex if EBs are used * fixed issue causing ElectrostaticSphereEB test to crash * fixed the logic for when to call computeE * added function to allow charge density to be deposited in rho_fp from outside WarpX * fixed inconsistency between labframe and relativistic electrostatic simulation setup * fixed typo * fixed issue that caused ElectrostaticSphere test to fail and removed unnecessary call to multiply E_y by -1 when doing a 2d simulation * revert edit to error handling string * changes requested during PR review * additional change requested during PR review * fixed typo * revert unnecessary changes
2021-08-20Updated the installation instructions (#2218)Gravatar Michael Kieburtz 1-1/+1
2021-08-20Improved error handling when the libwarpx shared object library can't be ↵Gravatar Michael Kieburtz 1-2/+7
loaded (#2215) * Improved error handling when the libwarpx shared library can't be loaded * Removed extra newline * Improved check and ended program on error
2021-08-16do_pml should not be parsed anymore. (#2183)Gravatar Revathi Jambunathan 1-2/+0
* do_pml not parsed. remove code that was added to support both types of boundary interface * add paranthesis * fix eol and move to BackwardCompatibility * missing semicolon * Update Source/WarpX.cpp * clean input files in examples * delete do_pml in performance test input * fixing an example input file in docs * Update Source/WarpX.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * cleaning up docs * Update Docs/source/usage/parameters.rst * fix eol Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-08-13Implemented new style BTD in picmi (#2187)Gravatar David Grote 1-0/+87
* Implemented new style BTD in picmi * Added rho_species. Added documentation
2021-08-07In add_particles, used None for input parameter values (#2169)Gravatar David Grote 1-21/+41
2021-08-05Add particle weight as an explicit argument for ↵Gravatar Roelof Groenewald 1-12/+15
_libwarpx.py::add_particles() (#2161) * added particle weight as an explicit argument for _libwarpx.py::add_particles() * changes requested during code review
2021-08-05Fixed bug where specifying write_dir for particle diagnostic did not work ↵Gravatar Kevin Z. Zhu 1-0/+5
(#2167)
2021-08-02Allow extra particle attributes (besides ux, uy, uz and w) to be set at ↵Gravatar Roelof Groenewald 1-12/+35
particle creation in AddNParticles() (#2115) * exposes AddRealComp to Python to allow extra particle attributes to be added at runtime; also includes a new function to grab a particle data array from the name of the component rather than the index * added functionality to AddNParticles() to allow extra particle attributes to also be set during particle creation * added function to get index of a particle component given the PID name * changed new get component index and get_particle_arrays_from_comp_name functions to take species name as argument rather than species id * changed warpx_addRealComp to accept a species name as input and only add the new component for that species * added a test of the pywarpx bridge to get particle data and add new particle attributes at runtime * changed all particle interacting functions in libwarpx to use the species name rather than id, also changed the functions to get particle array data to use the component name rather than index * updated test according to PR #2119 changes * removed unneeded BL_ASSERT(nattr == 1) statement * fixed bug in add_particles to correctly determine the number of extra attributes * fixed bug in AddNParticles if fewer attribute values are passed than the number of extra arrays for the species * use isinstance(attr, ndarray) rather than type(attr) is np.ndarray * generalize_runtime_comps_io * fix OpenPMD * fix OpenPMD * fix plot flags in WritePlotFile * fix offset and comment * changed extra pid test to not use an underscore in the pid name * switched _libwarpx.py::add_particles to use kwargs to accept the weight and extra attribute arrays * License update in test file Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * fix typo * added a test with unique_particles=False * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * updated docstring and comments Co-authored-by: atmyers <atmyers2@gmail.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-07-26PICMI inputs for MCC (#2098)Gravatar Roelof Groenewald 4-0/+62
* added functionality to picmi.py to initialize MCC collisions from python runscripts * bug fix and copyright declaration change * add Boltzmann's constant to picmi.py * added test for picmi MCC setup * set diagnostic output name for test and cleaned up analysis.py * fixed style issue with EOL white space after merge
2021-07-21PICMI - Embedded boundary (#2104)Gravatar Roelof Groenewald 1-0/+21
* added functionality to picmi.py to allow an embedded boundary to be set from a python run script * added test: embedded sphere run from python (the test is the same as ElectrostaticSphereEB) * added a line to prepare_file_travis.py so that tests with USE_EB=True are not included in Python CI test list * fixed import path in analysis.py file for new test * added WarpX_EB flag to setup.py so that embedded boundary functionality can be included in pip installs of pywarpx
2021-07-21Update picmi.py for new injection_style default (#2109)Gravatar Peter Scherpelz 1-1/+1
2021-07-21Use only species name in libwarpx (#2119)Gravatar Roelof Groenewald 1-73/+51
* changed all particle interacting functions in libwarpx to use the species name rather than id, also changed the functions to get particle array data to use the component name rather than index * removed unneeded function declaration
2021-07-20Python - add new particle attributes at runtime (#2112)Gravatar Roelof Groenewald 1-0/+91
* exposes AddRealComp to Python to allow extra particle attributes to be added at runtime; also includes a new function to grab a particle data array from the name of the component rather than the index * added function to get index of a particle component given the PID name * changed new get component index and get_particle_arrays_from_comp_name functions to take species name as argument rather than species id * changed warpx_addRealComp to accept a species name as input and only add the new component for that species
2021-07-15Typo fix in fields.py (#2095)Gravatar nruof 1-1/+1
2021-07-15Replace `injection_style = python` with `injection_style = none` (#2081)Gravatar Edoardo Zoni 1-3/+3
* Replace injection_style = python with injection_style = none * Update Docs * Add Default injection_style = none
2021-07-15Changed species to self.species as species is not defined (#2087)Gravatar KZhu-ME 1-1/+1
2021-07-12Fixes to RZ PSATD (#1945)Gravatar David Grote 1-2/+3
* For RZ, changed the sign of the density corrections near the axis * Further fixes for deposition correction near axis * Yet one more sign fix for charge density * For RZ spectral solver, filled in the guard cells below the radial axis * Fix white space at end of line * In RZ spectral backtransform, ensure box is valid * For RZ inverse volume scaling, fixed use of nGrow to use nGrowVect * Temporary fix adding damped cells in the domain interior * Bug fix for RZ PSATD scalar backward transform * Fixes for damping of the fields in the z-guards * Bug fix in DampFieldsInGuards * Bug fix in DampFieldsInGuards (for tiling) * Added warpx_amr_check_input input parameter * Removed unneeded damp and zero_in_domain input * Removed damping related code from picmi * Improved some comments in code copying field to the radial guard cells * Update Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp Simplify the expression for the sign Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Updated benchmarks * Updated tolerance for Langmuir analysis script * Updated CI test galilean_rz_psatd_current_correction Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
2021-07-12Update Python module comments (#2073)Gravatar David Grote 3-2/+26
* Added explanatory comments in timestepper.py * Add comments to WarpInterface.py * Added comments to WarpXPIC.py
2021-07-09Feature pass MPI comm from Python script to AMReX during initialization (#2034)Gravatar KZhu-ME 3-12/+26
* Added functionality to pass mpi comm from python script to amrex during initialization * Fixed missing _ in MPI._sizeof() * Added functions to get the current processor's rank and total number of processors * Renamed MPI_Comm to _MPI_Comm_type and defined _MPI_Comm_type in except statement * Updated comment to explain why mpi4py needs to be imported before loading libwarpx * Removed ifdef flags that prevent amrex_init_with_inited_mpi from being declared when MPI is off * Changed amrex_init_with_inited_mpi to be declared even when not using mpi, but will be defined to be functionally the same as amrex_init * Defined MPI = None to signify whether MPI is used, to add another check when initializing amrex * Changed ifdef blocks in WarpXWrappers.cpp/h to fix compile errors. Added ifdef block to conditionally declare amrex_init_with_inited_mpi in WarpXWrappers.h to prevent compile error when not using MPI. Removed ifdef block to declare/define same function in WarpXWrappers.cpp since function needs to be declared even when MPI is not used, but will never be called in that case. * Changed BL_USE_MPI to AMREX_USE_MPI and removed incorrect MPI=None statement * Changed BL_USE_MPI to AMREX_USE_MPI * Added test to verify correct passing of MPI communicator to amrex * Added ability to pass mpi_comm to sim.step * Change test to check for differeing outputs when passed different inputs * Removed obsolete comments refactored program to use more shared code * Refactored comments * Updated description to match test * Removed unecessary imports and updated comments
2021-07-06Add possibility to start and stop moving window (#2027)Gravatar thomas clark 2-2/+2
* Add possibility to start and stop moving window * Update Benchmark laserInjection_2d * Update Source/Diagnostics/BTDiagnostics.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * modification of the MoveWindow function in the python interface * False to True for move j in python function Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-07-06Input parameter for AMReX MLMG verbosity (#2041)Gravatar Michael Kieburtz 1-2/+5
* Added warpx_solver_verbosity input parameter - This input paramter is for the electrostatic solver to pass into MLMG::setVerbose(int) - Originally this value was hardcoded to 2 * readded accidently deleted line * Handle the default solver_verbosity value on the C++ side * Verbosity parameter now works the same as warpx.self_fields_max_iters - The input parameter for mlmg verbosity is now warpx.self_fields_verbosity - It still has a default value of 2. * fixed missing comma * added missing parameter to function call * Added documentation entry for warpx.self_fields_verbosity * corrected documentation * fixed formatting mistsake
2021-06-24Refactored basestring to str (#2030)Gravatar kzhu-ME 1-6/+6
2021-06-21Add damped to BC_map (#2021)Gravatar David Grote 1-1/+1