Skip to content

Commit

Permalink
Merge branch 'development' into add_analysis_embedded_boundary_remova…
Browse files Browse the repository at this point in the history
…l_depth
  • Loading branch information
RemiLehe committed Nov 18, 2024
2 parents 901bc6d + 55653b3 commit fe118a7
Show file tree
Hide file tree
Showing 77 changed files with 1,364 additions and 781 deletions.
12 changes: 0 additions & 12 deletions .azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
# Cartesian 3D
cartesian_3d:
WARPX_CMAKE_FLAGS: -DWarpX_DIMS=3 -DWarpX_FFT=ON -DWarpX_PYTHON=ON
WARPX_HEFFTE: 'TRUE'
# Cylindrical RZ
cylindrical_rz:
WARPX_CMAKE_FLAGS: -DWarpX_DIMS=RZ -DWarpX_FFT=ON -DWarpX_PYTHON=ON
Expand Down Expand Up @@ -121,17 +120,6 @@ jobs:
-DCMAKE_CXX_STANDARD=17 \
-Duse_cmake_find_lapack=ON -Dbuild_tests=OFF -DCMAKE_VERBOSE_MAKEFILE=ON
fi
if [ "${WARPX_HEFFTE:-FALSE}" == "TRUE" ]; then
cmake-easyinstall --prefix=/usr/local git+https://github.com/icl-utk-edu/heffte.git@v2.4.0 \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_CXX_STANDARD=17 -DHeffte_ENABLE_DOXYGEN=OFF \
-DHeffte_ENABLE_FFTW=ON -DHeffte_ENABLE_TESTING=OFF \
-DHeffte_ENABLE_CUDA=OFF -DHeffte_ENABLE_ROCM=OFF \
-DHeffte_ENABLE_ONEAPI=OFF -DHeffte_ENABLE_MKL=OFF \
-DHeffte_ENABLE_PYTHON=OFF -DHeffte_ENABLE_FORTRAN=OFF \
-DHeffte_ENABLE_MAGMA=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
fi
# Python modules required for test analysis
python3 -m pip install --upgrade -r Regression/requirements.txt
python3 -m pip cache purge
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ jobs:
-DBUILD_CLI_TOOLS=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_VERBOSE_MAKEFILE=ON
cmake-easyinstall --prefix=/usr/local \
git+https://github.com/icl-utk-edu/heffte.git@v2.4.0 \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_CXX_STANDARD=17 -DHeffte_ENABLE_DOXYGEN=OFF \
-DHeffte_ENABLE_FFTW=OFF -DHeffte_ENABLE_TESTING=OFF \
-DHeffte_ENABLE_CUDA=ON -DHeffte_ENABLE_ROCM=OFF \
-DHeffte_ENABLE_ONEAPI=OFF -DHeffte_ENABLE_MKL=OFF \
-DHeffte_ENABLE_PYTHON=OFF -DHeffte_ENABLE_FORTRAN=OFF \
-DHeffte_ENABLE_MAGMA=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
- name: build WarpX
run: |
export CCACHE_COMPRESS=1
Expand All @@ -92,7 +82,6 @@ jobs:
-DWarpX_openpmd_internal=OFF \
-DWarpX_PRECISION=SINGLE \
-DWarpX_FFT=ON \
-DWarpX_HEFFTE=ON \
-DAMReX_CUDA_ERROR_CROSS_EXECUTION_SPACE_CALL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS=ON
cmake --build build_sp -j 4
Expand Down Expand Up @@ -137,7 +126,7 @@ jobs:
which nvcc || echo "nvcc not in PATH!"
git clone https://github.com/AMReX-Codes/amrex.git ../amrex
cd ../amrex && git checkout --detach 24.11 && cd -
cd ../amrex && git checkout --detach 456c93c7d9512f1cdffac0574973d7df41417898 && cd -
make COMP=gcc QED=FALSE USE_MPI=TRUE USE_GPU=TRUE USE_OMP=FALSE USE_FFT=TRUE USE_CCACHE=TRUE -j 4
ccache -s
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/dependencies/hip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,3 @@ sudo curl -L -o /usr/local/bin/cmake-easyinstall https://raw.githubusercontent.c
sudo chmod a+x /usr/local/bin/cmake-easyinstall
export CEI_SUDO="sudo"
export CEI_TMP="/tmp/cei"

# heFFTe
#
cmake-easyinstall --prefix=/usr/local \
git+https://github.com/icl-utk-edu/heffte.git@v2.4.0 \
-DCMAKE_CXX_COMPILER_LAUNCHER=$(which ccache) \
-DCMAKE_CXX_STANDARD=17 -DHeffte_ENABLE_DOXYGEN=OFF \
-DHeffte_ENABLE_FFTW=OFF -DHeffte_ENABLE_TESTING=OFF \
-DHeffte_ENABLE_CUDA=OFF -DHeffte_ENABLE_ROCM=ON \
-DHeffte_ENABLE_ONEAPI=OFF -DHeffte_ENABLE_MKL=OFF \
-DHeffte_ENABLE_PYTHON=OFF -DHeffte_ENABLE_FORTRAN=OFF \
-DHeffte_ENABLE_MAGMA=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON
6 changes: 2 additions & 4 deletions .github/workflows/hip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ jobs:
-DWarpX_MPI=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=SINGLE \
-DWarpX_FFT=ON \
-DWarpX_HEFFTE=ON
-DWarpX_FFT=ON
cmake --build build_sp -j 4
export WARPX_MPI=OFF
Expand Down Expand Up @@ -122,8 +121,7 @@ jobs:
-DWarpX_MPI=ON \
-DWarpX_OPENPMD=ON \
-DWarpX_PRECISION=DOUBLE \
-DWarpX_FFT=ON \
-DWarpX_HEFFTE=ON
-DWarpX_FFT=ON
cmake --build build_2d -j 4
export WARPX_MPI=OFF
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ repos:
# Python: Ruff linter & formatter
# https://docs.astral.sh/ruff/
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.7.3
hooks:
# Run the linter
- id: ruff
Expand Down
37 changes: 0 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ option(WarpX_LIB "Build WarpX as a library" OFF)
option(WarpX_MPI "Multi-node support (message-passing)" ON)
option(WarpX_OPENPMD "openPMD I/O (HDF5, ADIOS)" ON)
option(WarpX_FFT "FFT-based solvers" OFF)
option(WarpX_HEFFTE "Multi-node FFT-based solvers" OFF)
option(WarpX_PYTHON "Python bindings" OFF)
option(WarpX_SENSEI "SENSEI in situ diagnostics" OFF)
option(WarpX_QED "QED support (requires PICSAR)" ON)
Expand Down Expand Up @@ -146,10 +145,6 @@ mark_as_advanced(WarpX_MPI_THREAD_MULTIPLE)

option(WarpX_amrex_internal "Download & build AMReX" ON)

if(WarpX_HEFFTE AND NOT WarpX_MPI)
message(FATAL_ERROR "WarpX_HEFFTE (${WarpX_HEFFTE}) can only be used if WarpX_MPI is ON.")
endif()

# change the default build type to Release (or RelWithDebInfo) instead of Debug
set_default_build_type("Release")

Expand Down Expand Up @@ -197,10 +192,6 @@ option(ABLASTR_FFT "compile AnyFFT wrappers" ${WarpX_FFT})
if(WarpX_FFT)
set(ABLASTR_FFT ON CACHE STRING "FFT-based solvers" FORCE)
endif()
option(ABLASTR_HEFFTE "compile AnyFFT wrappers" ${WarpX_HEFFTE})
if(WarpX_HEFFTE)
set(ABLASTR_HEFFTE ON CACHE STRING "Multi-Node FFT-based solvers" FORCE)
endif()

# this defined the variable BUILD_TESTING which is ON by default
include(CTest)
Expand Down Expand Up @@ -242,23 +233,6 @@ if(WarpX_FFT)
endif()
endif()

# multi-node FFT
if(WarpX_HEFFTE)
if(WarpX_COMPUTE STREQUAL CUDA)
set(_heFFTe_COMPS CUDA)
elseif(WarpX_COMPUTE STREQUAL HIP)
set(_heFFTe_COMPS ROCM)
elseif(WarpX_COMPUTE STREQUAL SYCL)
set(_heFFTe_COMPS ONEAPI)
else() # NOACC, OMP
set(_heFFTe_COMPS FFTW) # or MKL
endif()
# note: we could also enforce GPUAWARE for CUDA and HIP, which can still be
# disabled at runtime

find_package(Heffte REQUIRED COMPONENTS ${_heFFTe_COMPS})
endif()

# Python
if(WarpX_PYTHON)
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
Expand Down Expand Up @@ -499,10 +473,6 @@ foreach(D IN LISTS WarpX_DIMS)
endif()
endif()

if(ABLASTR_HEFFTE)
target_link_libraries(ablastr_${SD} PUBLIC Heffte::Heffte)
endif()

if(WarpX_PYTHON)
target_link_libraries(pyWarpX_${SD} PRIVATE pybind11::module pybind11::windows_extras)
if(WarpX_PYTHON_IPO)
Expand Down Expand Up @@ -593,13 +563,6 @@ foreach(D IN LISTS WarpX_DIMS)
target_compile_definitions(ablastr_${SD} PUBLIC ABLASTR_USE_FFT)
endif()

if(WarpX_HEFFTE)
target_compile_definitions(ablastr_${SD} PUBLIC WARPX_USE_HEFFTE)
endif()
if(ABLASTR_HEFFTE)
target_compile_definitions(ablastr_${SD} PUBLIC ABLASTR_USE_HEFFTE)
endif()

if(WarpX_PYTHON AND pyWarpX_VERSION_INFO)
# for module __version__
target_compile_definitions(pyWarpX_${SD} PRIVATE
Expand Down
2 changes: 1 addition & 1 deletion Docs/source/developers/fields.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Bilinear filter

The multi-pass bilinear filter (applied on the current density) is implemented in ``Source/Filter/``, and class ``WarpX`` holds an instance of this class in member variable ``WarpX::bilinear_filter``. For performance reasons (to avoid creating too many guard cells), this filter is directly applied in communication routines, see ``WarpX::AddCurrentFromFineLevelandSumBoundary`` above and

.. doxygenfunction:: WarpX::ApplyFilterJ(const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3>> &current, int lev, int idim)
.. doxygenfunction:: WarpX::ApplyFilterMF(const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3>> &mfvec, int lev, int idim)

.. doxygenfunction:: WarpX::SumBoundaryJ(const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3>> &current, int lev, int idim, const amrex::Periodicity &period)

Expand Down
2 changes: 0 additions & 2 deletions Docs/source/install/cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ CMake Option Default & Values Descr
``WarpX_PRECISION`` SINGLE/**DOUBLE** Floating point precision (single/double)
``WarpX_PARTICLE_PRECISION`` SINGLE/**DOUBLE** Particle floating point precision (single/double), defaults to WarpX_PRECISION value if not set
``WarpX_FFT`` ON/**OFF** FFT-based solvers
``WarpX_HEFFTE`` ON/**OFF** Multi-Node FFT-based solvers
``WarpX_PYTHON`` ON/**OFF** Python bindings
``WarpX_QED`` **ON**/OFF QED support (requires PICSAR)
``WarpX_QED_TABLE_GEN`` ON/**OFF** QED table generation support (requires PICSAR and Boost)
Expand Down Expand Up @@ -275,7 +274,6 @@ Environment Variable Default & Values Descr
``WARPX_PRECISION`` SINGLE/**DOUBLE** Floating point precision (single/double)
``WARPX_PARTICLE_PRECISION`` SINGLE/**DOUBLE** Particle floating point precision (single/double), defaults to WarpX_PRECISION value if not set
``WARPX_FFT`` ON/**OFF** FFT-based solvers
``WARPX_HEFFTE`` ON/**OFF** Multi-Node FFT-based solvers
``WARPX_QED`` **ON**/OFF PICSAR QED (requires PICSAR)
``WARPX_QED_TABLE_GEN`` ON/**OFF** QED table generation (requires PICSAR and Boost)
``BUILD_PARALLEL`` ``2`` Number of threads to use for parallel builds
Expand Down
3 changes: 1 addition & 2 deletions Docs/source/install/dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Optional dependencies include:
- `FFTW3 <http://www.fftw.org>`__: for spectral solver (PSATD or IGF) support when running on CPU or SYCL

- also needs the ``pkg-config`` tool on Unix
- `heFFTe 2.4.0+ <https://github.com/icl-utk-edu/heffte>`__: for multi-node spectral solver (IGF) support
- `BLAS++ <https://github.com/icl-utk-edu/blaspp>`__ and `LAPACK++ <https://github.com/icl-utk-edu/lapackpp>`__: for spectral solver (PSATD) support in RZ geometry
- `Boost 1.66.0+ <https://www.boost.org/>`__: for QED lookup tables generation support
- `openPMD-api 0.15.1+ <https://github.com/openPMD/openPMD-api>`__: we automatically download and compile a copy of openPMD-api for openPMD I/O support
Expand Down Expand Up @@ -81,7 +80,7 @@ Conda (Linux/macOS/Windows)

.. code-block:: bash
conda create -n warpx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git "heffte=*=mpi_mpich*" lapackpp "openpmd-api=*=mpi_mpich*" openpmd-viewer python make numpy pandas scipy yt "fftw=*=mpi_mpich*" pkg-config matplotlib mamba mpich mpi4py ninja pip virtualenv
conda create -n warpx-cpu-mpich-dev -c conda-forge blaspp boost ccache cmake compilers git lapackpp "openpmd-api=*=mpi_mpich*" openpmd-viewer python make numpy pandas scipy yt "fftw=*=mpi_mpich*" pkg-config matplotlib mamba mpich mpi4py ninja pip virtualenv
conda activate warpx-cpu-mpich-dev
# compile WarpX with -DWarpX_MPI=ON
Expand Down
15 changes: 15 additions & 0 deletions Docs/source/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -479,3 +479,18 @@ @article{VayFELB2009
doi = {10.1063/1.3080930},
url = {https://doi.org/10.1063/1.3080930},
}

@article{Rhee1987,
author = {Rhee, M. J. and Schneider, R. F. and Weidman, D. J.},
title = "{Simple time‐resolving Thomson spectrometer}",
journal = {Review of Scientific Instruments},
volume = {58},
number = {2},
pages = {240-244},
year = {1987},
month = {02},
issn = {0034-6748},
doi = {10.1063/1.1139314},
url = {https://doi.org/10.1063/1.1139314},
eprint = {https://pubs.aip.org/aip/rsi/article-pdf/58/2/240/19154912/240\_1\_online.pdf},
}
1 change: 1 addition & 0 deletions Docs/source/usage/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Particle Accelerator & Beam Physics
examples/gaussian_beam/README.rst
examples/beam_beam_collision/README.rst
examples/free_electron_laser/README.rst
examples/thomson_parabola_spectrometer/README.rst

High Energy Astrophysical Plasma Physics
----------------------------------------
Expand Down
23 changes: 17 additions & 6 deletions Docs/source/usage/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ Overall simulation parameters
The PS-JFNK method is described in `Angus et al., An implicit particle code with exact energy and charge conservation for electromagnetic studies of dense plasmas <https://doi.org/10.1016/j.jcp.2023.112383>`__ . (The version implemented in WarpX is an updated version that includes the relativistic gamma factor for the particles.) Also see `Chen et al., An energy- and charge-conserving, implicit, electrostatic particle-in-cell algorithm. <https://doi.org/10.1016/j.jcp.2011.05.031>`__ .
Exact energy conservation requires that the interpolation stencil used for the field gather match that used for the current deposition. ``algo.current_deposition = direct`` must be used with ``interpolation.galerkin_scheme = 0``, and ``algo.current_deposition = Esirkepov`` must be used with ``interpolation.galerkin_scheme = 1``. If using ``algo.current_deposition = villasenor``, the corresponding field gather routine will automatically be selected and the ``interpolation.galerkin_scheme`` flag does not need to be specified. The Esirkepov and villasenor deposition schemes are charge-conserving.

* ``strang_implicit_spectral_em``: Use a fully implicit electromagnetic solver. All of the comments for ``theta_implicit_em``
above apply here as well (except that theta is fixed to 0.5 and that charge will not be conserved).
In this version, the advance is Strang split, with a half advance of the source free Maxwell's equation (with a spectral solver), a full advance of the particles plus longitudinal E field, and a second half advance of the source free Maxwell's equations.
The advantage of this method is that with the Spectral advance of the fields, it is dispersionless.
Note that exact energy convergence is achieved only with one grid block and ``psatd.periodic_single_box_fft == 1``. Otherwise,
the energy convservation is spoiled because of the inconsistency of the periodic assumption of the spectral solver and the
non-periodic behavior of the individual blocks.

* ``semi_implicit_em``: Use an approximately energy conserving semi-implicit electromagnetic solver. Choices for the nonlinear solver include a Picard iteration scheme and particle-suppressed JFNK.
Note that this method has the CFL limitation :math:`\Delta t < c/\sqrt( \sum_i 1/\Delta x_i^2 )`. The Picard solver for this method can only be expected to work well when :math:`\omega_{pe} \Delta t` is less than one.
The method is described in `Chen et al., A semi-implicit, energy- and charge-conserving particle-in-cell algorithm for the relativistic Vlasov-Maxwell equations <https://doi.org/10.1016/j.jcp.2020.109228>`__.
Expand All @@ -105,16 +113,16 @@ Overall simulation parameters
exactly energy conserving, but the solver may perform better.

* ``implicit_evolve.nonlinear_solver`` (`string`, default: None)
When `algo.evolve_scheme` is either `theta_implicit_em` or `semi_implicit_em`, this sets the nonlinear solver used
When `algo.evolve_scheme` is either `theta_implicit_em`, `strang_implicit_spectral_em`, or `semi_implicit_em`, this sets the nonlinear solver used
to advance the field-particle system in time. Options are `picard` or `newton`.

* ``implicit_evolve.max_particle_iterations`` (`integer`, default: 21)
When `algo.evolve_scheme` is either `theta_implicit_em` or `semi_implicit_em` and `implicit_evolve.nonlinear_solver = newton`
When `algo.evolve_scheme` is either `theta_implicit_em`, `strang_implicit_spectral_em`, or `semi_implicit_em` and `implicit_evolve.nonlinear_solver = newton`
, this sets the maximum number of iterations for the method used to obtain a self-consistent update of the particles at
each iteration in the JFNK process.

* ``implicit_evolve.particle_tolerance`` (`float`, default: 1.e-10)
When `algo.evolve_scheme` is either `theta_implicit_em` or `semi_implicit_em` and `implicit_evolve.nonlinear_solver = newton`
When `algo.evolve_scheme` is either `theta_implicit_em`, `strang_implicit_spectral_em`, or `semi_implicit_em` and `implicit_evolve.nonlinear_solver = newton`
, this sets the relative tolerance for the iterative method used to obtain a self-consistent update of the particles at
each iteration in the JFNK process.

Expand Down Expand Up @@ -2186,10 +2194,13 @@ Time step
Filtering
^^^^^^^^^

* ``warpx.use_filter`` (`0` or `1`; default: `1`, except for RZ FDTD)
Whether to smooth the charge and currents on the mesh, after depositing them from the macro-particles.
* ``warpx.use_filter`` (`0` or `1`)
Whether to use filtering in the simulation.
With the explicit evolve scheme, the filtering is turned on by default, except for RZ FDTD.
With the implicit evolve schemes, the filtering is turned off by default.
The filtering smoothes the charge and currents on the mesh, after depositing them from the macro-particles.
With implicit schemes, the electric field is also filtered (to maintain consistency for energy conservation).
This uses a bilinear filter (see the :ref:`filtering section <theory-pic-filter>`).
The default is `1` in all cases, except for simulations in RZ geometry using the FDTD solver.
With the RZ PSATD solver, the filtering is done in :math:`k`-space.

.. warning::
Expand Down
1 change: 1 addition & 0 deletions Examples/Physics_applications/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ add_subdirectory(plasma_acceleration)
add_subdirectory(plasma_mirror)
add_subdirectory(spacecraft_charging)
add_subdirectory(uniform_plasma)
add_subdirectory(thomson_parabola_spectrometer)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Add tests (alphabetical order) ##############################################
#

add_warpx_test(
test_3d_thomson_parabola_spectrometer # name
3 # dims
1 # nprocs
inputs_test_3d_thomson_parabola_spectrometer # inputs
analysis_default_openpmd_regression.py # analysis
diags/diag1 # output
OFF # dependency
)
Loading

0 comments on commit fe118a7

Please sign in to comment.