aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralSolver.cpp (follow)
AgeCommit message (Collapse)AuthorFilesLines
2021-07-08Do Not Fill Guard Cells with Inverse FFTs, Unless for Field Damping (#2045)Gravatar Edoardo Zoni 1-4/+10
* Do Not Always Fill Guard Cells with Inverse FFTs * Query psatd.fill_guards from Inputs * Clean Up and Reduce Style Changes * Fix Bug for Periodic Single Box * Clean Up and Reduce Style Changes * Fix Bug for RZ PSATD * Remove Input Parameter, Default 0 Unless Damping * Fix CI Tests (2D) * Fix CI Tests (3D)
2021-06-28Multi-J scheme (#1828)Gravatar Remi Lehe 1-19/+4
* Introduce new option skip_deposition * Properly implement the option to skip deposition * Skip deposition for electrostatic solver * Correct typo * Add Index Enumerator and Equations for F/G Without Averaging * Define new functions for current deposition and charge deposition * Disable interpolation between levels * Correct compilation error in RZ mode * Add argument for relative time * Add Index Enumerator and Equations for F/G With Averaging * [skip ci] Add new OneStep function * Fix compilation errors * Correct more compilation errors * [skip ci] Fix compilation * Split the PSATD push into separate functions * Add guards for rho field * [skip ci] Use new functions in OneStep * [skip ci] Separate the inverse transform of E_avg, B_avg * Add deposition of rho * [skip ci] Prevent deposition of rho if unallocated * Fix error in deposition function * Add subcycling of current deposition * [skip ci] Add inverse transform of averaged fields * [skip ci] Move component of rho * Add function to copy J * Temporarily deactivate contribution from F * [skip ci] Implement call to linear in J * Add psatd time averaging for multiJ * [skip ci] Fix implementation of averaging * [skip ci] Implement divE cleaning * Fix Bug for RZ Builds * Fix Bug for RZ Builds * Fix Bug in Init of PML Spectral Solvers * Cleaning * Cleaning * Add div(B) Cleaning (G Equation) * Multi-J Not Implemented with Galilean PSATD or PMLs * Add 2D CI Test Using Multi-J Scheme * Add More Inline Comments * Add More Inline Comments & Doxygen * Add Doxygen for Constructor of SpectralSolver * More Doxygen in Class SpectralSolver * Add Doxygen for New Functions in WarpXPushFieldsEM.cpp * Add Doxygen for New Functions in WarpX/MultiParticleContainer * do_dive/b_cleaning Must Be True With linear_in_J Option * Cast multij_n_depose to Real in Divisions * New Input Syntax * Add const where Possible, Fix Warnings * Docs for New Input Syntax, Fix Abort Messages * Consistent Use of Idx, IdxAvg, IdxLin * Improve Documentation of psatd.J_linear_in_time * Use const Type Qualifier whenever Possible * Simplify Initialization of Pointer ion_lev * Improve Doxygen * Update documentation * Add Note on NCI to Docs * Make warpx.do_multi_J_n_depositions Not Optional * Simplify Logic in getRequiredNumberOfFields * Use More const Type Qualifiers Co-authored-by: Edoardo Zoni <ezoni@lbl.gov>
2021-06-24Use "Include What You Use" on WarpX (#1947)Gravatar Luca Fedeli 1-5/+5
* initial tests with IWYU * added a couple of forward declarations * used iwyu on more files * progress * used iwyu on more files * progress with iwyu * progress with iwyu * fixed bug * progress with iwyu * progress with IWYU * progress with IWYU * fixed bug * fixed bug * progress with IWYU * progress with IWYU + use forward declarations in WarpX.H * first try with .def files * fix bugs * progress with IWYU * progress with IWYU * progress with iwyu * correct copyright * fixed bug * fixed bugs * fix missing include * fixed bug * fix bug * fix bug introduced during last bugfix * use iwyu on newly added files * add space * fix bug * fix missing include * fix missing include * fix missing include * fixed bugs * fixed bug * attempt at fixing issue with math functions * added missing include * fixed missing include * using _fwd.H * fixed bug * progress with iwyu * update AMReX branch * enforce alphabetic order * progress with iwyu * use right version of amrex * use right version of amrex for tests * fixed bug * fix another bug * fix missing include * fix missing include * fix missing include * updated amrex * initial work to document new include strategy * updated documentation * Fix rst & private includes * Remove accidentially added files * Fix rst code blocks * one more rst block Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-04-19Divergence cleaning for PSATD in PML (#1600)Gravatar Edoardo Zoni 1-2/+4
* Add div(E)/div(B) cleaning options for PSATD in PMLs * Pass missing flags to spectral solver in PML * Duplicate MPI exchange and communication functions for G * Use separate parameters for div cleaning in PMLs * Add asserts for features that are not implemented * Do not need to duplicate MPI exchange functions for G * Add short documentation for new input parameters * Set new parameters true by default with PSATD solver * Add CI test for PML div cleaning with PSATD * Use new syntax <diag_name>.intervals in new input file * Reset benchmark of new CI test * Always synchronize nodal points of G MultiFab * Fix few warnings in 2D build * Update Benchmark of pml_psatd_dive_divb_cleaning * Improve Documentation of warpx.do_pml_dive_cleaning Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Improve Documentation of warpx.do_pml_divb_cleaning Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com> * Improve Abort Message * Clean Up Co-authored-by: Neïl Zaim <49716072+NeilZaim@users.noreply.github.com>
2021-03-16Add timers in routines that depend on cell-related work (#1692)Gravatar Michael E Rowan 1-6/+9
* Add timers * eol * AtomicAdd * lev argument for getCosts * style * style * wip * eol * .ipynb * passing down lev * eol * passing lev * eol * Update Source/Particles/Collision/PairWiseCoulombCollision.cpp Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja> * Add for QED and ionization routines * eol * remove unneeded * mfi-->pti * move cost * eol Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
2021-03-04Implement averaged algo on staggered grids & merge spectral classes (#1544)Gravatar Edoardo Zoni 1-20/+7
* Refactor and clean up some spectral classes * Abort when current correction or Vay deposition are not implemented * Implement general equations for averaged Galilean * Allocate averaged MultiFabs also when aux_is_nodal=1 and do_nodal=0 * Allocate +ngextra guard cells also for averaged MultiFabs * Make alias MultiFabs for averaged aux data * With averaging, interpolate from avg_fp (not fp) to aux * Fix some limits of the coefficients * Fix bug causing NaNs in spectral coefficients * Add 2D CI test with same analysis as nodal test * Add 3D CI test with same analysis as nodal test * Add limit that was not covered (knorm=0 && knorm_c!=0 && nu=0) * Allocate T2_coef only if Galilean algorithm is used * Allocate X4_coef only if Galilean algorithm is used * Remove extra ghost cell from 'avg_fp' MultiFabs
2020-12-02Improve spectral solver on staggered grids (#1468)Gravatar Edoardo Zoni 1-6/+14
* Implement Galilean PSATD equations on staggered grids * Implement high-order interpolation in 2D/3D * Include missing header file and small clean-up * Fix bug for FDTD build * Small clean-up * Modify current correction for staggered grids * Implement comoving PSATD scheme (formulation with rho) * Fix single-precision builds * Do not implement rho-free formulation for comoving PSATD yet * Invert sign of comoving velocity to match Galilean convention * Fix two bugs in comoving PSATD algorithm * Update benchmark of CI test momentum-conserving-gather * Update benchmark of CI test PlasmaAccelerationMR * Update documentation * Clean up comoving PSATD class * Clean up comoving PSATD class (more) * Clean up comoving PSATD class (more) * Implement changes requested in PR review * Add 2D regression test for staggered Galilean PSATD * Add 2D regression test for staggered comoving PSATD * Unify input files for new CI tests to avoid duplication * Fully rebase benchmarks changes on development * Update benchmark of Galilean hybrid test after #1536
2020-10-19Replace wherever possible '.reset(new' with '= make_unique' (#1429)Gravatar Luca Fedeli 1-8/+10
* replace wherever possible .reset(new with = make_unique * fixed bug * fixed bug * revert WarpXOpenPMD.cpp to the original version * removed another .reset(new
2020-08-06Galilean PSATD: current correction and rho-free formulation (#1151)Gravatar Edoardo Zoni 1-1/+1
* Introduce option to update E with/without rho * Clean up * Implement current correction for Galilean PSATD (needs bug fix) * Include equations in docs * Fix EOL whitespaces error * Small clean-up * Implement Galilean PSATD update without rho * Clean up * Fix bug in current correction * Fix EOL whitespaces * Clean up * Fix unused import * Remove unused variable * [skip CI] Improve docs * Clean up style * Fix EOL whitespaces * Fix EOL whitespaces * Clean up style * Revert analysis script to old status * [skip CI] Clean up style * Make equations more human-readable and improve comments * 2D test with current correction works * Temporary build fix as in #1197 * 3D test with current correction works * Rename th and th_star as theta and theta_star * Fix a couple of wrong comments * Add vertical spaces to improve readability * Improve documentation * Function CurrentCorrection is now pure * 2D benchmark fields data are now correct * Add limits of coefficients for nu=-1 * Change default of update_with_rho for Galilean PSATD
2020-07-14make fft_do_time_averaging a member of class WarpX (#1165)Gravatar MaxThevenet 1-4/+2
2020-07-08Averaged Galilean PSATD (#869)Gravatar Olga Shapoval 1-11/+24
* Read Galilean velocity * Prepare structures for Galilean solver * Started implementing Galilean equations * Analytical limits for X1, X2, X3, X4 coefficients added * Slight changes added * Added Galilean position pusher * Scale galilean velocity * Remove unneeded Abort * Fix Galilean pusher * Allocate Theta2 array * Fix definition of coefficients * Increase guard cells for Galilean * Add guard cell in particle exchange * Added modifications for PICSAR galilean branch * Averaged coefficients added * Type corrected * v_gal added to warpx_current_deposition * v_gal added to WarpXParticleContainer.H * Bug fixed - update particle x-position over one time step * Fix issues with merge from dev * Averaged fileds allocated on fine patch (Ex) * Preparation for merging dev into galilean. * remove TABs by hand * Removed a tab. * Redeclared v_galilean as a vector & related changed * Added an automated test * Moved v_galilean inside WarpX constructor * Added analysis script for the automated test * Changed name of the automated test to galilean_psatd * Added InitializeSpectralCoefficients method * Removed temporary comments * Averaged fields added to FiledGather * Added infinite order k[i] * Setting kx_mod( kz_mod) = 0 for index = nx/2(-nz/2) * Adding galilean shift * Implemented galilean shift * Changed method's name from GalileanShift to ShiftGalileanBoundary * Added doxygen string for ShiftGalileanBoundary * Removed never used method LowerCornerWithCentering * Removed temporary comments * Removed dt as a variable from DepositCharge method and its dependencies * Changing type of v_galilean from amrex::Vector to amrex::Array * Changed back ng_fft to be equal nox_fft * Changed v_galilean's type from amrex::vector to amrex::array * Removed type * Removed temporary comments * Added flag 'do_time_averaging' to swith from unaveraged to averaged Galilean PSATD * Updated doxygen * Small fix on using 'do_time_averaging' flag * Remove some commented Print statements * [skip ci] Further cleanup * Fix compilation * Guard cells update of the averaged E,B fields * Corrected included header file accordingly * Removed EOL * Removed EOL * Corrected path of the included header file * Updated choice of the spectral solver. * Cleanup. * use amrex::exp instead of std::exp * no backward FFT for avg fields if avg is off * Need to shift avg fields in MoveWindow * Further cleaning * Added 2D automated test for averaged PSATD * Added automated 2D and 3D tests for averaged PSATD * Removed comments * Added specifications for averaged Galilean PSATD tests. * Bug fixed - do FillBoundary of the averaged fields only if averaged is activated * Do shiftMF of the averaged fields only if fft_do_time_averaging=true * Add checksum json benchmarks for averaged Galilean PSATD * Add missing indentation * Add missing indentation * Updated automated analysis script * Updated diags period * Fixed bug: no backtransform of the averaged fields when WARPX_DIM_RZ is set * Fixed an uninitialized variable * Clean-up * Changed permissions for analysis_avg_*d.py * Compactified variables initialization via conditional assignment * Initialized averaged E_avg, B_avg fields * Updated automated test for 2D averaged galilean PSATD * Updated benchmark for 2D averaged galilean PSATD * Updated automated 2D averaged PSATD test & benchmark * Updated automated 3D averaged PSATD test & benchmark * Fixed typo * Updated benchmark averaged_galilean_3d_psatd * Initialize the averaged fields only if the averaged Galilean PSATD algorithm is enabled * Encreased time step for automated 3D averaged Galilean PSATD (to be equal c*dt=dz while dz/dx=3) * Updated 3D automated test: specified standard deviations `.ux_th, .uy_th, .uz_th` along each direction * Typo from the previous commit: enabled the averaged algorithm * Trying out another input parameters for 3D averaged automated test with v_gal = v_plasma * Update benchmark for previously added 3D averaged automated test * Update 2D averaged automated test and corresponding benchmark * Revert "Updated diags period" This reverts commit 7334729b05e96589e020c981efdb430ca095991d. * Cleanup: removed unwanted comment. * Added descriptions of the 2D and 3D automated tests for the averaged Galilean PSATD. * Updated value calculated via standard Galilean PSATD. * Encreased relative error tolerance for 3D automated test for the averaged Galilean PSATD. * Removed to avoid duplication since it already specified in the corresponding 2D/3D input scripts. * Removed unwanted empty lines * Added spaces after function's names * Removed unwanted empty line * Removed * Fixed indentation * Cleanup: removed #include <math.h> * Cleanup: removed empty lines and fixed indentation * Added 'AvgGalileanAlgorithm.cpp' to 'CMakeLists.txt' Co-authored-by: Remi Lehe <remi.lehe@normalesup.org> Co-authored-by: MaxThevenet <mthevenet@lbl.gov>
2020-07-06PSATD: add option to update E without using rho (#1128)Gravatar Edoardo Zoni 1-2/+3
* Introduce option to update E with/without rho * Clean up * Include equations in docs * Fix EOL whitespaces error * Small clean-up * Clean up
2020-04-02Periodic, single-box FFT (#881)Gravatar Remi Lehe 1-2/+3
* Implement periodic-single box option for spectral * Fix out-of-bound in the periodic, single-box case * Add documentation for periodic_single_box_fft
2020-02-25Includes: Clean Up (#743)Gravatar Axel Huebl 1-6/+10
- Use `""` for WarpX-local includes - Order: WarpX `""`, AMReX `<>`, other third party includes `<>` - Add dir prefixes for WarpX Add order to includes by including from `Source/` onward and keeping directory prefixes of non-local includes for clarity.
2020-02-24Profiler wrapper to allow for cudaDeviceSynchronize (#738)Gravatar MaxThevenet 1-2/+30
* add warpx profiler wrapper * call WX profiler wrapper instead of BL * EOL and cleaning * add doc on profile syncs * do not use PROFILE macros in .H files * replace WX_PROFILE with WARPX_PROFILE and use bool instead of int * typo * this file shouldn't be there
2020-02-18Galilean PSATD with shift (#704)Gravatar Olga Shapoval 1-4/+14
* Read Galilean velocity * Prepare structures for Galilean solver * Started implementing Galilean equations * Analytical limits for X1, X2, X3, X4 coefficients added * Slight changes added * Added Galilean position pusher * Scale galilean velocity * Remove unneeded Abort * Fix Galilean pusher * Allocate Theta2 array * Fix definition of coefficients * Increase guard cells for Galilean * Add guard cell in particle exchange * Type corrected * v_gal added to warpx_current_deposition * v_gal added to WarpXParticleContainer.H * Bug fixed - update particle x-position over one time step * Fix issues with merge from dev * Preparation for merging dev into galilean. * Adding galilean shift * Implemented galilean shift * Changed method's name from GalileanShift to ShiftGalileanBoundary * Added doxygen string for ShiftGalileanBoundary * Removed never used method LowerCornerWithCentering * Removed temporary comments * Removed dt as a variable from DepositCharge method and its dependencies * Converted tab to spaces * Removed EOL white space * Add documentation and automated tests * Fix compilation error * Add automated test * Update automated test * Removed temporary used galilean shift * Removed temporary used particle's push for Galilean PSATD * Removed unused statement * Remove EOL white space. * Added zero shift for LowerCorner in RZ geometry * Minor changes to Galilean implementation * Modifications for GPU * Fix typo Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
2020-01-27Automatically add copyright header with update_copyright.shGravatar Tools 1-0/+6
2019-05-04Initialize spectral solverGravatar Remi Lehe 1-0/+1
2019-05-03Prepare spectralsolver for PMLGravatar Remi Lehe 1-4/+16
2019-05-02Start implementation of spectral PMLGravatar Remi Lehe 1-1/+2
2019-05-01Add commentsGravatar Remi Lehe 1-1/+5
2019-04-30Fix typoGravatar Remi Lehe 1-1/+2
2019-04-30Add separate file for constructorGravatar Remi Lehe 1-0/+30