aboutsummaryrefslogtreecommitdiff
path: root/Examples/Physics_applications (follow)
AgeCommit message (Collapse)AuthorFilesLines
2023-08-12Transition to pyAMReX (#3474)Gravatar Axel Huebl 1-8/+5
* pyAMReX: Build System * CI Updates (Changed Options) * Callback modernization (#4) * refactor callbacks.py * added binding code in `pyWarpX.cpp` to add or remove keys from the callback dictionary * minor PR cleanups Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Added Python level reference to fetch the multifabs (#3) * pyAMReX: Build System * Added Python level reference to Ex_aux * Now uses the multifab map * Fix typo Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Add initialization and finalize routines (#5) A basic PICMI input file will now run to completion. * Regression Tests: WarpX_PYTHON=ON * Update Imports to nD pyAMReX * IPO/LTO Control Although pybind11 relies heavily on IPO/LTO to create low-latency, small-binary bindings, some compilers will have troubles with that. Thus, we add a compile-time option to optionally disable it when needed. * Fix: Link Legacy WarpXWrappers.cpp * Wrap WarpX instance and start multi particle container * Fix test Python_pass_mpi_comm * Start wrapper for multiparticle container * Add return policy Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update fields to use MultiFabs directly Remove EOL white space Removed old routines accessing MultiFabs Update to use "node_centered" * Fix compilation with Python * Update fields.py to use modified MultiFab tag names * Remove incorrect, unused code * Add function to extract the WarpX MultiParticleContainer * Complete class WarpXParticleContainer * Wrap functions getNprocs / getMyProc * restore `install___` callback API - could remove later if we want but should maintain backward compatibility for now * add `gett_new` and `getistep` functions wrappers; fix typos in `callbacks.py`; avoid error in getting `rho` from `fields.py` * Update callback call and `getNproc`/`getMyProc` function * Replace function add_n_particles * Fix setitem in fields.py for 1d and 2d * also update `gett_new()` in `_libwarpx.py` in case we want to keep that API * added binding for `WarpXParIter` - needed to port `libwarpx.depositChargeDensity()` which is an ongoing effort * Wrap function num_real_comp * added binding for `TotalNumberOfParticles` and continue progress on enabling 1d MCC test to run * add `SyncRho()` binding and create helper function in `libwarpx.depositChargeDensity` to manage scope of the particle iter * Clean up issues in fields.py * update bindings for `get_particle_structs` * Fix setitem in fields.py * switch order of initialization for particle container and particle iterator * switch deposit_charge loop to C++ code; bind `ApplyInverseVolumeScalingToChargeDensity` * move `WarpXParticleContainer.cpp` and `MultiParticleContainer.cpp` to new Particles folder * added binding for `ParticleBoundaryBuffer` * More fixes for fields.py * Fix: Backtraces from Python Add the Python executable name with an absolute path, so backtraces in AMReX work. See linked AMReX issue for details. * Cleaning * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix: Backtraces from Python Part II Do not add Python script name - it confuses the AMReX ParmParser to build its table. * Fix: CMake Dependencies for Wheel This fixes a racecondition during `pip_install`: it was possible that not all dimensions where yet build from pybind before we start packing them in the wheel for pip install. * MCC Test: Install Callbacks before Run Otherwise hangs in aquiring the gil during shutdown. * addition of `Python/pywarpx/particle_containers.py` and various associated bindings * Fix: CMake Superbuild w/ Shared AMReX We MUST build AMReX as a shared (so/dll/dylib) library, otherwise all the global state in it will cause split-brain situations, where our Python modules operate on different stacks. * add `clear_all()` to callbacks in order to remove all callbacks at finalize * add `-DWarpX_PYTHON=ON` to CI tests that failed to build * add `get_comp_index` and continue to port particle data bindings * Add AMReX Module as `libwarpx_so.amr` Attribute to pass through the already loaded AMReX module with the matching dimensionality to the simulation. * Fix for fields accounting for guard cells * Fix handling of ghost cells in fields * Update & Test: Particle Boundary Scraping * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * CI: Python Updates - modernize Python setups - drop CUDA 11.0 for good and go 11.3+ as documented already ``` Error #3246: Internal Compiler Error (codegen): "there was an error in verifying the lgenfe output!" ``` * CI: Python Updates (chmod) * Add support for cupy in fields.py * Add MultiFab reduction routines * CI: CUDA 11.3 is <= Ubuntu 20.04 * changed `AddNParticles` to take `amrex::Vector` arguments * setup.py: WarpX_PYTHON=ON * update various 2d and rz tests with new APIs * add `-DWarpX_PYTHON_IPO=OFF` to compile string for 2d and 3d Python CI tests to speed up linking * CI: -DpyAMReX_IPO=OFF * CI: -DpyAMReX_IPO=OFF actually adding `=OFF` * CI: Intel Python * CI: macOS Python Executable Ensure we always use the same `python3` executable, as specified by the `PATH` priority. * CMake: Python Multi-Config Build Add support for multi-config generators, especially on Windows. * __init__.py: Windows DLL Support Python 3.8+ on Windows: DLL search paths for dependent shared libraries Refs.: - https://github.com/python/cpython/issues/80266 - https://docs.python.org/3.8/library/os.html#os.add_dll_directory * CI: pywarpx Update our setup.py cannot install pyamrex yet as a dependency. * ABLASTR: `ablastr/export.H` Add a new header to export public globals that are not covered by `WINDOWS_EXPORT_ALL_SYMBOLS`. https://stackoverflow.com/questions/54560832/cmake-windows-export-all-symbols-does-not-cover-global-variables/54568678#54568678 * WarpX: EXPORT Globals in `.dll` files WarpX still uses a lot of globals: - `static` member variables - `extern` global variables These globals cannot be auto-exported with CMake's `WINDOWS_EXPORT_ALL_SYMBOLS` helper and thus we need to mark them manually for DLL export (and import) via the new ABLASTR `ablastr/export.H` helper macros. This starts to export symbols in the: - WarpX and particle container classes - callback hook database map - ES solver * CI: pywarpx Clang CXXFLAGS Down Move CXXFLAGS (`-Werror ...`) down until deps are installed. * GNUmake: Generate `ablastr/export.H` * CMake: More Symbol Exports for Windows * `WarpX-tests.ini`: Simplify Python no-IPO Also avoids subtle differences in compilation that increase compile time. * Update PICMI_inputs_EB_API.py for embedded_boundary_python_API CI test * Fix Python_magnetostatic_eb_3d * Update: Python_restart_runtime_components New Python APIs * Windows: no dllimport for now * CI: Skip `PYINSTALLOPTIONS` For Now * CMake: Dependency Bump Min-Versions for external packages picked up by `find_package`. * Fix F and G_fp names in fields.py * Tests: Disable `Python_pass_mpi_comm` * Wrappers: Cleanup * pyWarpX: Include Cleaning * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fields.py: Fix F and G Wrappers Correct MultiFab names (w/o components). * Remove unused in fields.py * Windows: New Export Headers - ABLASTR: `ablastr/export.H` - WarpX: `Utils/export.H` * removed `WarpInterface.py` since that functionality is now in `particle_containers.py`; removed parts of `WarpXWrappers.cpp` that have been ported to pyamrex * CMake: Link OBJECT Target PRIVATE * CMake: Remove OBJECT Target Simplify and make `app` link `lib` (default: static). Remove OBJECT target. * Fix in fields.py for the components index * Update get_particle_id/cpu As implemented in pyAMReX with https://github.com/AMReX-Codes/pyamrex/pull/165 * WarpX: Update for Private Constructor * Import AMReX Before pyd DLL Call Importing AMReX will add the `add_dll_directory` to a potentially shared amrex DLL on Windows. * Windows CI: Set PATH to amrex_Nd.dll * CMake: AMReX_INSTALL After Python In superbuild, Python can modify `AMReX_BUILD_SHARED_LIBS`. * Clang Win CI: Manually Install requirements Sporadic error is: ``` ... Installing collected packages: pyparsing, numpy, scipy, periodictable, picmistandard ERROR: Could not install packages due to an OSError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\hostedtoolcache\\windows\\Python\\3.11.4\\x64\\Lib\\site-packages\\numpy\\polynomial\\__init__.py' Consider using the `--user` option or check the permissions. ``` * Hopefully final fixes to fields.py * Update getProbLo/getProbHi * Set plasma length strength Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> * Fix fields method to remove CodeQL notice * Update Comments & Some Finalize * Move: set_plasma_lens_strength to MPC --------- Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com> Co-authored-by: David Grote <dpgrote@lbl.gov> Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> Co-authored-by: Dave Grote <grote1@llnl.gov> Co-authored-by: Roelof Groenewald <regroenewald@gmail.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-06-30Allocate fewer `rho` components for ES, MS, hybrid-PIC solvers (#4036)Gravatar Remi Lehe 2-3/+3
* Allocate fewer components for `rho` * Fix compilation * Use two components with dive_cleaning * Fix Python script * Fix PICMI script for 1D CI test --------- Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
2023-06-16correct seperate --> separate (#3998)Gravatar Luca Fedeli 1-1/+1
2023-06-02Histogram 2D (#3883)Gravatar Juliette Pech 2-3/+78
* Histogram 2D A new functionality has been added. The files ParticleHistogram2D.cpp and ParticleHistogram2D.H allow the user to plot a 2D histogram that computes the number of particles for a given abscissa and ordinate. * Modification to solve NVCC 11.8.0 GNUmake issue ParticleHistogram2D.cpp added into Make.package * Test for using openPMD Test to activate the plug in for openPMD : #ifdef WARPX_USE_OPENPMD Error message otherwise. * Test for using openPMD continued * New version of the ParticleHistogram2D option The user can now choose the value of the weight via a value_function. Another parameter was therefore added : w The documentation has also been updated and an example (input file + python script for postprocessing) has been added to Examples/Physics_application/laser_ion * Python script updated The python script written for postprocessing the ParticleHistogram2D option has been renamed to pass a check test. The argparse module has also been added to the code instead of the originally implemented command line interaction. Now the user must pass arguments when executing the script. * Input files of the laser-ion example merged The input file originally created for the 2D histogram has been merged with the initial input file "inputs" of the example. * Correction of a display bug * Help function for openPMD files A help function has been created to find the correct file type when writing openPMDfiles. Another update : the file type will be returned in the warpx_used_inputs file after running a simulation. * Typo fixed in the python script used for 2D histograms visualisation Typo for the shape of the data * Typo in the help function file created * Some typo fixed for checks Modifications in the input file of the laser-ion example and in the ParticleHistogram2D.cpp file. * Typo fixed : declaration on the WarpXOpenPMDFileType function outside #ifdef WARPX_USE_OPENPMD * Typo for failing check NVCC 11.8.0 GNUmake * Typo for failing check NVCC 11.8.0 GNUmake (continued) * Typo for failing check NVCC 11.8.0 GNUmake (continued, abort message) * .cpp file added to Make.package * Time added to the data Simulation time is now visible on Hist2D plots * Update Docs/source/dataanalysis/reduced_diags.rst Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Docs/source/usage/parameters.rst Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Examples/Physics_applications/laser_ion/analysis_histogram_2D.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Examples/Physics_applications/laser_ion/analysis_histogram_2D.py Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Docs/source/usage/parameters.rst Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Docs/source/usage/parameters.rst Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Diagnostics/ReducedDiags/ParticleHistogram2D.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Diagnostics/ReducedDiags/ParticleHistogram2D.H Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Diagnostics/ReducedDiags/ParticleHistogram2D.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Diagnostics/OpenPMDHelpFunction.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Diagnostics/OpenPMDHelpFunction.H Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Multiple hist2D active in the same simulation now possible The laser-ion example as well as the documentation have been modified accordingly. * Display enhancement for the laser-ion example * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-05-04Fix: Laser-Ion Example Gather (#3894)Gravatar Axel Huebl 1-0/+4
Guarantee improved plasma stability for 2D with very low initial target temperature when using Esirkepov current deposition with energy-conserving field gather (default).
2023-04-12Reflect density from non-periodic boundaries during deposition (#3711)Gravatar Roelof Groenewald 1-1/+1
* refactored the charge deposition fix to be performed with the field data rather than individual particles * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * also correct current density at PEC boundary * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * corrections pointed out during code review * fix build fails due to unused variables * fix issue with GPU builds * actually apply rho boundary correction in EM case * first round of CI fixes * second round of CI fixes * added description of deposition logic with PEC boundaries to documentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * third round of CI fixing * move J and rho boundary handling to after `SyncRho` and `SyncCurrent` calls * properly order the application of boundary conditions on rho, for electrostatic simulations * fourth round of CI fixing * don't apply J field boundary in `MultiParticleContainer::DepositCurrent` * apply changes requested during code review * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Loosen tolerance on failing CI test * Removed unused variable * deal with fine versus coarse patches * move the `ApplyRhofieldBoundary` call to after `SumBoundary` * use a uniform calculation for the number of cells a given index is from the boundary * remove unused variable * limit number of ghost cells updated during PEC BC application * the number of ghost cells to consider depends on whether the field is nodal or not --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
2023-02-27Change plotfile RZ allowed diags to r,t from x,y (#3663)Gravatar Ryan Sandberg 1-1/+1
* change plotfile RZ allowed diag to r,t from x,y * Change labeling in checksums * add rz silver mueller analysis script * make analysis_silver_mueller_rz.py executable * change x,y fields to r,t in more tests * x->r in MR RZ checksums * correct analysis for plotfiles saved as 'boxlib' * add self to creator list * change rz diags in PICMI * correct PICMI changes * another y->t in an rz test * update picmi plotfile rz btd names * review suggestion to condense analysis * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> --------- Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
2023-02-01Fix NUniformPerCell for 1D (#3659)Gravatar David Grote 1-33/+33
* Fix NUniformPerCell for 1D * Fix CI benchmarks
2023-01-17Modify refined injection CI test for anisotropic ref ratio (#3605)Gravatar Prabhat Kumar 1-5/+6
* Modify refined ijection CI to account for anisotropic ref ratio * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * change n_move based on new dt * change variable name to be more specific * Update Regression/WarpX-tests.ini Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * reset benchmark for RefineInjection because now it uses anisotropic refinement ratio * add comment to show the formula for n_move * Reset benchmark of `RefinedInjection` * Remove wrong benchmark file Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
2022-11-09BTD: remove old/legacy back-transformed diagnostics (#3485)Gravatar Remi Lehe 2-6/+0
* Start removing old BTD * Remove GetCellCenteredData * Remove do_backtransform_fields and do_backtransform_particles * Remove more functions * Remove more variables * Update documentation * Fix CI test `RigidInjection_BTD` * Remove slicing from `BTD_ReducedSliceDiag` * Rename `BTD_ReducedSliceDiag` as `LaserAcceleration_BTD` * Query deprecated input and abort Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
2022-10-25Add warning to set zmin and zmax for ion-acc example (#3323)Gravatar Marco Garten 1-10/+17
* Add warning to set zmin and zmax for ions and also change the ion acceleration example to set these parameters so that users are aware that memory overflow could happen for production-size examples furthermore, correct units in comment after definition of r0 and Lcut Replace zmin and zmax with variables for electrons * Reset checksum for regression test Reset benchmark for LaserIonAcc2d test because the particle initialization in the input changed.
2022-10-25Diagnostics: print when writing openPMD/Ascent/Sensei and BTD ↵Gravatar Ryan Sandberg 1-5/+8
plotfile/openPMD (#3424) * print when writing openPMD, Ascent, Sensei * remove unnecesssary variables, include min_digits * print snapshot id when writing btd * fix ascent print * compile without warnings * still working on Ascent * still working Ascent * Print when BTD buffer is flushed * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * print when writing openPMD, Ascent, Sensei * remove unnecesssary variables, include min_digits * print snapshot id when writing btd * fix ascent print * compile without warnings * still working on Ascent * still working Ascent * Print when BTD buffer is flushed * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add warning message if BTD not full * adjust for CI, no in-situ vis BTD * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert to correct plotfile naming * change warning topic to BTD * nicer format for print statements * extend examples to fill BTD * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Reset Checksums of BTD_ReducedSliceDiag * Upgrade CI Test LaserAccelerationBoost * Apply suggestions from code review Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> * improve BTD warning notes * edit final step notes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix formatting Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Edoardo Zoni <ezoni@lbl.gov> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-10-12Correct particle positions outside refined injection (#3463)Gravatar Remi Lehe 1-2/+11
* Correct particle positions outside refined injection * Improve test * Update benchmark * Update Examples/Physics_applications/laser_acceleration/analysis_refined_injection.py
2022-09-30Implement tridiag solver for 1D (#3431)Gravatar David Grote 2-46/+57
* Added tridiag solve for 1D * Added tridiag solver to WarpX.H * Updated PICMI_inputs_1d.py to use float64 This was done so that it will compare to the tridiag to machine precision * Updated 1D capacitive_discharge test, adding pythonsolver flag * Update capacitive_discharge analysis_1d.py file with updated reference data * Add periodic boundary conditions, plus other fixes * Added CI test Python_background_mcc_1d_tridiag * Fix for parallel * Fixed CI test file prefix for PICMI_inputs_1d.py * Fixed comments
2022-09-29Add 1d support to `_libwarpx.py` functions `get_particle_X` (#3421)Gravatar Roelof Groenewald 1-12/+13
* add 1d support to _libwarpx.py functions `get_particle_X` * add coverage of 1d `_libwarpx.get_particle_z` to test suite
2022-09-23fix labels in inputfiles (#3422)Gravatar Luca Fedeli 3-3/+3
2022-09-20More fixes for capacitive_discharge PICMI tests (#3416)Gravatar David Grote 2-3/+3
2022-09-19Fixes to Physics_applications/capacitive_discharge/PICMI* (#3413)Gravatar David Grote 2-3/+3
2022-08-22Remove outdated comments from example input files (#3332)Gravatar Luca Fedeli 4-4/+4
Update comments in example input files: moving window now available along x, y, z.
2022-08-17Allow filtering in z with RZ FDTD (#3281)Gravatar David Grote 1-1/+2
* Allow filtering in z with RZ FDTD * Update the error message about filtering in RZ * Turned z filtering on in laser_acceleration/inputs_rz * Update LaserAccelerationRZ benchmark, including z filtering
2022-08-11`isort`: AMReX, WarpX, etc. as First Party (#3307)Gravatar Axel Huebl 2-2/+4
* `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-04Species variables in diagnostics: deal with runtime components (#3218)Gravatar Neïl Zaim 2-4/+4
* Species variables in diagnostics: deal with runtime components * Remove ParticleStringNames namespace * Use const reference in iteration variable * Fix ion acc 2D test * Output extra (e.g. initialized later with python) comps by default * Always output theta in RZ * Fix QED tests * Fix Laser Acceleration RZ test
2022-07-02Use amrex::RandomNormal in Maxwell-Boltzmann momentum injection (#3209)Gravatar Neïl Zaim 1-1/+1
* Use amrex::RandomNormal in Maxwell-Boltzmann momentum injection * Remove factor sqrt(2) in std calculation * Update benchmarks * Increase relative tolerance for Python_background_mcc checksum * Update Source/Initialization/InjectorMomentum.H Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com> Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
2022-06-13Extend MCC to accurately treat relativistic particles (#3118)Gravatar Roelof Groenewald 3-12/+178
* initial commit for MCC to support relativistic particles * proper calculation of collision energy when target mass is not much greater than projectile mass * fix bug with scattered velocity rotation to lab frame * refactor the MCC sequence for clarity * use cross-section input to determine energy limits when calculating the maximum collision frequency * code cleanup * updated CI tests * added Collisions section to Implementation Details in docs * reset benchmark for mixed precision MCC test and other more code cleanup * fix issue with single precision and simplified implementation * use `double` for particle mass and energy calculations in MCC * added comment to ImpactIonization.H explaining why `double`s are used for `energy` and `mass` * switch to round off safe version of energy calculation and switched to using u instead of v for gamma*v in ParticleUtils.H * update documentation * simplified expression for collision energy, updated docs * Add comment that the direct solver can be replaced for the MLMG solver once the issue with that solver is fixed (in the 1d MCC test)
2022-04-05LoadBalanceCosts: num_cells & num_macro_particles (#3019)Gravatar Axel Huebl 1-2/+6
* Examples: LBC in Laser-Ion Example * LoadBalanceCosts: num_cells & num_macro_particles * Fix Script: Wrong Header Counting Spliced out the first to columns twice. * Fix Script: Blocking Factor The script did not work if a direction only had one block * Fix Script: 2D/3D There is no generic way from the data we write to find this out, without breaking corner cases such as one-block in one direction.
2022-04-04Moving Frame Field Probe Functionality (#2996)Gravatar Tiberius Rheaume 3-0/+42
* DRAFT for Moving Frame * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Adds m_last_compute_step * Generalized SetParticlePosition, semicolons and formatting * Update Source/Diagnostics/ReducedDiags/FieldProbe.H Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Moved particle push before calculations. Condensed stuff. * Fixed Velocity, added start and stop time functionality * Documentation * Apply suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Empty-Commit * Fixed ParallelFor from review * FP moving window in laser_acceleration 1d, 2d, 3d test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Line detector instead of point 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-03-25Add Field Probe to Laser Ion Test (#2998)Gravatar Tiberius Rheaume 1-1/+27
2022-03-22openPMD RZ modes dumped in thetaMode (#2878)Gravatar Ryan Sandberg 1-1/+0
* [Draft] openPMD: RZ Modes * Change 'theta' to 't' and 'J' to 'j' * Docs: openPMD rz notes * editing docs openPMD RZ note * erase cartesian E,B,j from openPMD rz diags list * openpmd rz: theta->t, exclude xyz dumps * openpmd rz: axes r,z, save as comp[mode][r][z] * catch logic bugs tracking when in rz mode * change return type to c++17 tuple in helper fn * allow divB functor to store in theta mode * tuple bindings / account for theta mode variables * only r,t,z componets in RZ, separate rz field init * separate rz field init, arbitrary diags in RZ * docs: xyz comps in cartesian, rtz in rz geometry * docs : remove mention of dump_rz_modes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * clarify documentation of InitializeFieldFunctorsRZ * n_rz_modes = 1 if not in RZ * style change for brackets * style, documentation, clarify magic constants * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add helper getVec * transpose RZ openPMD data for proper viewing * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * safe for 2d and rz * fix transpose order of limits, add tinyProfiler * document transpose function, lack of optimization * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix divB num components * keeping changes to openPMD+RZ, not general RZ * divB made more similar to divE * eliminate or document unused variables * fix openPMD+RZ documentation * change thetaMode parser to regex * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * replace n_rz_azimuthal_modes with warpx variable ncomps * Ignore Unused Var in Cartesian * add rz openpmd analysis * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix warnings: unused vars * clarify documentation of dump_rz_modes * cleaning up before sending to PR * remove divB, divE, test in a different PR * Update Source/Diagnostics/WarpXOpenPMD.cpp fix Dxygen strings Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * clean up doxygen, note issue in divB * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixing rz_opmd test, still not passing * Fix: Unused <diag>.dump_rz_modes * updating openPMD+rz analysis * Regression Setup: set `outputFile` * Use HDF5 Backend This is most likely installed by all developers, so we use it for tests. * Code Style Updates * simplify test and reduce code redundancy * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * reduce redundancy 1 less line * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep HDF5 HDF5 is easier to install for developers and provided in CI. * Style fixes * Style fix Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-03-07properly handle MCC collision subcycling (#2934)Gravatar Roelof Groenewald 1-0/+5
2022-03-03Rename `serialize_ics` as `serialize_initial_conditions` (#2925)Gravatar Edoardo Zoni 10-10/+10
* Rename `serialize_ics` as `serialize_initial_conditions` * Add Backward Compatibility Check
2022-03-03file_min_digits: 5->6 (#2385)Gravatar Axel Huebl 1-1/+1
* file_min_digits: 5->6 100k+ step runs are quite common in WarpX. To simplify post-processing scripts, increase the default to pad to 6 digits. This might break some hand-written scripts that use `?????` wild-cards over `*` wildcards in regex and thus need to be updated. But it at the same time simplifies regexes for analysis of data series and listing of such file series. * Update Scripts to Handle New File Names * Fix CI Test pml_x_psatd * Fix CI Test divb_cleaning_3d * Fix CI Tests with EB Support * Fix CI Tests with RZ Support * Fix CI Tests with PICMI Support * Use glob in Analysis of Collision Tests * Use rstrip in Analysis of Collision Tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix CI Tests for Langmuir_multi_1d/psatd * Fix CI Tests for LaserInjection_1d * Checkpoint-Restart Tests: 5 Digits `regtest.py` in `regression_testing` hard-codes 5 digits: ```diff --- a/regtest.py +++ b/regtest.py @@ -734,7 +734,7 @@ def test_suite(argv): shutil.move(test.diffDir, orig_diff_dir) # get the file number to restart from - restart_file = "%s_chk%5.5d" % (test.name, test.restartFileNum) + restart_file = "%s_chk%6.6d" % (test.name, test.restartFileNum) ``` * PICMI Restart Tests: `warpx_file_min_digits = 5` Same as other CI restart tests: hard-coded value in regression suite makes this necessary. X-ref: https://github.com/AMReX-Codes/regression_testing/issues/119 Co-authored-by: Edoardo Zoni <ezoni@lbl.gov> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-02-11User-defined integer and real particle attributes (#2735)Gravatar Revathi Jambunathan 4-0/+14
* define user attributes, parse them, initialize with respective parsers * fix warning by using static_cast for int attribute as parser returns real * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * clean-up from self-review * adding dimensionless velocity, gamma*v/c and time to parser argument * add documentation * typo in comment * unused var * device vector for kernels * particle attribute in developer doc * data ptr for device vector * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * ignore_unused * Docs: Describe all particle attributes including pre-defined ones :) * Docs: Fix formatting (user params) * Add: 1D and RZ Support * Docs: Fix Typo in Function Declaration * Laser-Ion Example: User-Defined Attrib. Add two user-defined attributes to the laser-ion acceleration example. This is a 2D test. Documents the name in the table of commonly used, user-defined attribute names. The attribute added is the original position of particles, which I like to plot in "potential" plots that correlate original position in the target with final energy. * changing user-interface API with .attribute. and no need for separate 1D 2D 3D RZ code for parser. pos.x/y/z returns the right values * Adding 1D, 3D, and rz tests * attribute in inputs * at(i) * refinining names for inputs for laser ion and acceleration tests * typo in input * reset benchmarks for test-cases that included attributes Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2022-02-023D LWFA PICMI Test: Add Electron Beam (#2723)Gravatar Edoardo Zoni 1-0/+30
* LWFA PICMI Tests: Add Electron Beam * Remove Electron Beam from 1D Test
2022-01-25Add SyncRho call to warpx_depositChargeDensity (#2777)Gravatar Roelof Groenewald 2-4/+2
* 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-25RZ FDTD: Filter Not Working (Abort) (#2775)Gravatar Edoardo Zoni 2-2/+2
* RZ FDTD: Filter Not Working (Abort) * Update CI Tests and Benchmarks
2022-01-21Access species specific charge density from python (#2710)Gravatar Roelof Groenewald 3-1/+260
* 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-12Make moving window dimensionality consistent in PICMI (#2721)Gravatar Prabhat Kumar 3-3/+3
* 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-07Particle Buffer for Backtransformed Diagnostics (#1898)Gravatar Revathi Jambunathan 1-1/+1
* move BTD call before Redistribute * define particle buffer, BTD particle functor, particle filter * select particles on the slice * add particle functors * add Lorentz Transform * fix conflict * add call to loretnz operator * storing Particles in buffer * This is WIP. Added particle buffers, filled them, sent them for flush with number already flushed. Does not work for multiple flushes. Crashes for OpenPMD. * trailing endif after rebase * adding print statements and not flushing particles in OPENPMD if numpart is 0 * last timestep flush is ensured at the end of evolve loop * fix bug in declaring uy uy new and computing uzp * set particle Geom, BA, and DMAP for particle flush with plotfile * set Particle BA Geom DMAP for particle buffer and no BTD transform for force flush * separate compute and pack from flush * Fix Typo: resizeable -> resizable Fixes HDF5 BTD particle output. * new class for plotfile particles for BTD * copy particle_H and DATA and Header. some WIP print statements * Merge plotfile * clean print statements * fix warning message * struct declaration in header, fix warning * doxygen comments and copyright * clean print statements * fix eol and override function warning * tile data * fix output species array size bug * fix access for particle buffer size * clean and move time-update * add cur_time update back * remove cur time update which was called twice * dont access particles flushed already for full diagnostics * cur time must be updated for RigidInjection BTD CI test to pass * temporarily move call to BTD * updating time and calling BTD before movewindow * cleanup * reset benchmarks and analysis script * clean and add comments * fix particle box array, geom, dmap * reset benchmarks for multi_J rz and ElectrostaticSphereEB_mixedBC * wip commit * wip commit * add SI conversion * abort for openpmd bp backend if species is selected. Also write particle output for BTD only if write_species is 1 * add documentation for aborting if adios is used with openpmd and add other BTD input parameters * Apply suggestions from code review commit Axel's suggestions from review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * use bool instead of int * fix doxygen format * using h5 as backend in example test to ensure consistency with abort for particle output. * fix doxygen comment * reset benchmark again for comoving_2d_psatd galilean_2d_psatd multi_J_rz_psatd * reset benchmark for background_mcc * self-review suggestions * reset benchmarks. Update with last snapshot full info * Axel's PR suggestions Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Axel's doxygen fix Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * add comments * fix eol * improved exception handling for stringsteam * PR suggestions * Axels' suggestions from code review Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Axel's suggestions :) Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * simplify logic * suggestions from review (Axel/Reva) Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * variable name change for clarity * if num particles in tmp array is 0, return * Use new BTD inputs to set up BTD for particles in the corresponding particle container * unused var * fix logic error * speciesID undefined * separate particle and field buffer calls and initialization for BTD. Data common to both are initialized separately * rename variable so it does not ghost existing varname * add more comments * Assert that fields are on * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * redundant function definition * unused variable * unused variable zp * 1D 2D 3D definition * fix else * Apply suggestions from code review Add Prabhat's suggestion Co-authored-by: Prabhat Kumar <89051199+prkkumar@users.noreply.github.com> * missing semicolon and ignore xp yp for 1D * resetting benchmarks for boosted sims and mcc sim * temporarily changing tolerance since the relative difference for momentum_z is 3.68e-3 and the current tolerance is 2.5e-3 Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Prabhat Kumar <89051199+prkkumar@users.noreply.github.com>
2022-01-04Add PICMI Scripts for LWFA Tests (#2700)Gravatar Edoardo Zoni 9-160/+589
* Add PICMI Script for 2D Case * Add PICMI Script for 3D Case * Cleaning * Add PICMI Script for 1D Case * Add PICMI Script for RZ Case * Remove Old PICMI Script * Remove Old Test Python_LaserAccelerationMR * inputs_3d: Move Inputs From runtime_params * inputs_2d: Move Inputs From runtime_params * Update PICMI Script for 2D Case * Update PICMI Script for 3D Case * inputs_1d: Move Inputs From runtime_params * inputs_2d_rz: Move Inputs From runtime_params * Rename inputs_2d_rz as inputs_rz * Update PICMI Script for 1D Case * Update PICMI Script for RZ Case * inputs_rz: Fix Diagnostic Interval * Fix Diagnostic Interval For All Inputs * Add New Test For Each PICMI Script * Remove Old PICMI Script From Workflow yml Files * Dump RZ Modes for RZ Case * LWFA PICMI: Add Shellbang Add missing shellbang lines. Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-12-22Change _libwarpx.py functions to LibWarpX class methods (#2696)Gravatar Peter Scherpelz 1-2/+1
* 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 7-2/+11
* 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 13-22/+23
* 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-16Wrap shared object in a class to control its loading (#2637)Gravatar David Grote 1-7/+3
* 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-15Examples: Python ShellBang & Executable (#2673)Gravatar Axel Huebl 6-2/+10
* Examples: Python ShellBang & Executable Make sure that all PICMI scripts and all analysis Python scripts in `Examples/` are: - executable (`chmod a+x`) - start with a shell-bang to `python3` Now, all scripts can be run directly without a `python3 ...` prefix and also default to the only right executable of Python on older systems. (New systems always have a `python3` alias, too.) * Revert a moved numpy
2021-12-14Fix: `pre-commit run -a` (#2671)Gravatar Axel Huebl 1-1/+0
Prepare to enable autofix bot from https://pre-commit.ci
2021-12-10PWFA 1D: Fix output nameGravatar Axel Huebl 1-1/+1
Hard coded, undocumented convention: turns out this must be the name of the test that we define in the ini file. Logical, isn't it. Not. Follow-up to #2593
2021-12-091D tests for plasma acceleration (#2593)Gravatar Prabhat Kumar 3-1/+139
* 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-11-19add github ci compile check for ascent (#2483)Gravatar Cyrus Harrison 1-0/+76
* add github ci compile check for ascent * now with less whitespace * add ascent to insitu workflow * Update .github/workflows/insitu.yml Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * more style * try to run as existing user * new container * use env script * path fix * add ascent test * fix space * move test resources * get into style * style * Ascent CI: Cleanup (#1) - make sure inputs file stays up-to-date - locate alongside example * Update .github/workflows/insitu.yml Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Update .github/workflows/insitu.yml Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * rename test file * fix for cp * improve color table for vol rendering * now with rotation Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-11-16Clean up input files for tests with MCC (#2552)Gravatar Roelof Groenewald 3-28/+23
* Added embedded_circle test * Add embedded_circle test files * Removed diag files * removed PICMI input file * Update to use default regression analysis * Added line breaks for spacing Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Added description * Added Ar and Xe to pre-defined particle types * added Boltzmann's constant to pre-defined constants and cleaned up the MCC CI test input * Added Boltzmann's constant to warpx parser * cleaned up embedded circle CI test input * Remove duplicate entry. Co-authored-by: kzhu-ME <kevin.zhu@modernelectron.com> Co-authored-by: Kevin Z. Zhu <86268612+KZhu-ME@users.noreply.github.com> Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-11-08Install pre-commit (#2532)Gravatar Axel Huebl 4-4/+1
* 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