Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge devin hs2 #148

Open
wants to merge 380 commits into
base: HarrisSheetinX
Choose a base branch
from
Open

Merge devin hs2 #148

wants to merge 380 commits into from

Conversation

RevathiJambunathan
Copy link
Owner

No description provided.

ax3l and others added 30 commits September 24, 2024 06:23
For consistency of naming with other fields, this might be a better
spelling of the bold name :)
* Python: `warpx.multifab` legacy signature

Keep the legacy signature of the fully qualified name a bit
longer to avoid breakage. Throw warnings for users to migrate.

* Update Docs

* Simplify Example String

No f-string needed here.

* Old API: Do not warn yet

* Clang-Tidy
…ECP-WarpX#5324)

* un-multiply done

* Update Source/ablastr/fields/PoissonSolver.H

---------

Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Keep ownership on the C++ side.
Fix the missing include for `MultiLevelRegister`, which includes
the MultiLevel MF types.
Fix the missing include for `MultiLevelRegister`, which includes
the MultiLevel MF types.
ECP-WarpX#5289)

* Fixed a bug where centering coefficients used in Magentostatic solver were not being initialized when doing an energy-conserving field gather.

Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Pointer type passed into the magnetostatic solver for current is no longer smart, so removed the call to get() to return the raw pointer.

Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>

---------

Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Remove m_cell_centered_data from multifab map

* Register cell_centered_data MultiFab

* Cleaning & Member Variable Convention

* Shorten: fields as variable

Prepares to remove `WarpX` class altogether from here.

---------

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
* `FieldType`: Top Doxygen Comment

Add a general top level comment.

* Doxygen: Expand `AMREX_ENUM`

* `FieldType`: Doxygen Oneline

Use a comment form that will still work after it gets
pasted and squashed into a single line after macro expansion.

* Doc: Include in Sphinx

* RTD: Doxygen 1.9.1 to latest
* Skip Guard in IGF Solver (Revert ECP-WarpX#5284)

This reverts the inclusion of the guard cells when copying
rho. We could not yet determine why, but with this change
the FFT 3D solver in ImpactX does not converge to the
analytical solutions anymore.

* Reset Checksum
…CP-WarpX#5226)

* General moving-window transformations in boosted-frame simulations

* Default speed of moving window to speed of boosted frame

* Extend simulation volume enough so that particles don't exit

* Include moving window speed in diag_lo and diag_hi transformations

* Modify bounds so as to produce the same results as in previous versions

---------

Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
* AMReX: Weekly Update

* pyAMReX: Weekly Update
Move the boundary handler to become an optional argument, which
otherwise defaults to Dirichlet conditions, e.g., in non-EB cases.

This simplifies the ImpactX implementation and fixes a linker issue
with CUDA for ImpactX.
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.7 → v0.6.8](astral-sh/ruff-pre-commit@v0.6.7...v0.6.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Do not default-advertise to enable heFFTe on Perlmutter and Lonestar
yet.
Introduce user-facing default for all HPC systems at a later point
when it makes more sense.
The package `cuda-nvtx-dev` does not seem to be part of the `cuda` package.
https://anaconda.org/nvidia/repo

This fixes:
```
CMake Error at build/_deps/fetchedamrex-src/Tools/CMake/AMReXParallelBackends.cmake:71 (target_link_libraries):
  Target "amrex_3d" links to:

    CUDA::nvToolsExt

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

Call Stack (most recent call first):
  build/_deps/fetchedamrex-src/Src/CMakeLists.txt:40 (include)
```
* use plasma current rather than total current in `HybridPICSolveE`
* remove logic to subtract J_ext from plasma current in `JdispFunctor`
* add one ghost cell to the hybrid-pic external current since we interpolate to a nodal grid
* Fix Doxygen

Signed-off-by: roelof-groenewald <regroenewald@gmail.com>
…pX#5308)

When `pre-commit` gets auto-updated, we typically see a PR from the
branch `pre-commit-ci-update-config`.

This branch is created directly in the main fork (unlike the individual
branches that WarpX contributors create from their own forks) and all CI
checks run twice:
- once for the activity on the PR that `pre-commit` automatically opens
(these CI checks are labeled "PR automated")
- once for the activity on the branch `pre-commit-ci-update-config`
(these CI checks are labeled "individual CI")

Here's an example:
![Screenshot from 2024-09-23
15-54-57](https://github.com/user-attachments/assets/836476f4-e6f6-4ca8-92a6-128050727ed5)

On top of this, once the PR is merged, CI runs a third time, because the
merge is counted as activity on the branch `development` (again
"individual CI").

We should be able to safely skip "individual CI" for the activity on the
branch `pre-commit-ci-update-config`. This PR should do the trick,
although it's good to double check the syntax for GitHub Actions and
Azure pipelines.

My understanding is that the cleanup-cache and post-PR workflows don't
need to be updated, also to be double checked.

---------

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Added the ability to synchronize particle velocities and positions
inside a python script via simulation.extension.warx.synchronize().

Initiated after discussion with @roelof-groenewald in
ECP-WarpX#5331.

Implemented and tested by comparing to Turner's benchmark results
(https://doi.org/10.1063/1.4775084).

<p align="center"> <img
src="https://github.com/user-attachments/assets/366aab43-359d-440c-a67c-7eef97028f4f">
This feature replaces the InitializeExternalFieldsOnGridUsingParser with
a more general function ComputeExternalFieldOnGridUsingParser. The new
function takes parsed functions with four dimensions (x,y,z,t), so that
it can be used to evaluate functions throughout the simulation, for
example time-dependent external fields.

The function ComputeExternalFieldOnGridUsingParser has optional edge
length and face areas.

---------

Co-authored-by: Kristoffer Lindvall <kristoffer.lindvall@novatronfusion.com>
Prepare the October release of WarpX:
```bash
# update dependencies
./Tools/Release/updateAMReX.py
./Tools/Release/updatePICSAR.py  # no changes, still 24.09
./Tools/Release/updatepyAMReX.py
# bump version number
./Tools/Release/newVersion.sh
```

Following this workflow:
https://warpx.readthedocs.io/en/latest/maintenance/release.html
* Explicitly use gcc-12, because gcc points to gcc/7.5.
* Load the non-cray version of hdf5 because the cray version has some
cmake issues.
The script was not robust enough for the black/ruff formatting updates we applied. This affected the 24.09 and 24.10 release tags. This fixes it.
Update installation instructions for the Lawrencium Cluster (LBNL).
Having a consistent set of base input files can make default testing
easier for package managers (e.g., Spack, Conda).

Example pointed out by @ax3l:
https://github.com/spack/spack/blob/d21577803f7acb4cc1a5b8144762ea052f67ecab/var/spack/repos/builtin/packages/warpx/package.py#L469
Now that all MultiFabs are registered in the new system, the old
`multifab_map` can be removed.

Note that the `imultifab_map` is still needed since the new system does
not yet work with `iMultiFabs`.

This breaks the Python API since it removes `warpx.field` which was
returning the old map.
Fix ECP-WarpX#5206 and prepare for ECP-WarpX#5256:
- [x] Add missing checksums
  - [x] `test_1d_background_mcc_picmi`
  - [x] `test_2d_background_mcc_picmi`
  - [x] `test_3d_particle_absorption`
  - [x] `test_2d_dirichlet_bc`
  - [x] `test_2d_dirichlet_bc_picmi`  
  - [x] `test_2d_field_probe` 
  - [x] `test_3d_embedded_boundary_picmi`
  - [x] `test_2d_particle_reflection_picmi` 
  - [x] `test_rz_laser_acceleration_opmd` 
  - [x] `test_2d_runtime_components_picmi` 
- [x] Clean up calls to `evaluate_checksum`

Calls to `evaluate_checksum` are now uniform across the analysis
scripts, making it easier to automatize further changes. Hopefully the
uniformity will be preserved by copy/pasting the necessary code:
- ```py
  import os
  import sys
  ```
- ```py
  sys.path.insert(1, "../../../../warpx/Regression/Checksum/")
  from checksumAPI import evaluate_checksum
  ```
- ```py
  # compare checksums
  evaluate_checksum(
      test_name=os.path.split(os.getcwd())[1],
      output_file=sys.argv[1],
  )
  ```
with this last one possibly modified by adding other arguments, e.g.,
`output_format`, `rtol`, `do_particles`, etc.
Fix some RST `verbatim`, which needs two backticks compared to Markdown.
ax3l and others added 28 commits February 10, 2025 16:12
**Magnetic Reconnection: An Alternative Explanation of Radio Emission in
Galaxy Clusters** by Subham Ghosh and Pallavi Bhat was just published.
https://10.3847/2041-8213/ad9f2d

---------

Co-authored-by: Edoardo Zoni <59625522+EZoni@users.noreply.github.com>
)

Updated highlights in WarpX docs for 20205 PRAB article describing how
to simulate oblique laser pulses in quasicylindrical geometry using
WarpX.
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
…rpX#5619)

The calculation of Fornberg stencil coefficients is rather general, and
it can be shared with other projects of the BLAST family. Therefore,
this PR moves the responsible functions into `ablastr`.

Specifically, the PR does the following:

- 2 new files (`FiniteDifference.H` and `FiniteDifference.cpp`) are
created under `ablastr/math` (`CMakeLists.txt` and `Make.package`
accordingly)
- the static method of the WarpX class `getFornbergStencilCoefficients`
and the `ReorderFornbergCoefficients` function (originally defined in an
anonymous namespace in `WarpX.cpp`) are moved to these new files, inside
the namespace `ablastr::math`
- the two methods are minimally adapted (e.g.,
`AMREX_ALWAYS_ASSERT_WITH_MESSAGE` becomes
`ABLASTR_ALWAYS_ASSERT_WITH_MESSAGE`)
- `WarpX.cpp` and `SpectralKSpace.cpp` (where the aforementioned
functions were called) are updated

Note that with this PR `SpectralKSpace.cpp` does not need anymore to
include the heavy `WarpX.H` header.
<!--pre-commit.ci start-->
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.4 →
v0.9.6](astral-sh/ruff-pre-commit@v0.9.4...v0.9.6)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…#5642)

This PR turns the static variable `em_solver_medium` of the WarpX class
into a private non-static member variable : `m_em_solver_medium` . This
is done with the aim of reducing the usage of static variables in WarpX.
This PR bumps the version used for `clang-tidy` CI tests from 16 to 17.
It also addresses all the issues found with the upgraded tool.

To be merged **after** ECP-WarpX#5592 ✅

### The issues found 🧐 and fixed 🛠️ with the upgraded tool are the
following :

-
[bugprone-switch-missing-default-case](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone/switch-missing-default-case.html)
A newly introduced check to flag `switch` statements without a `default`
case (unless the argument is an `enum`)

-
[cppcoreguidelines-rvalue-reference-param-not-moved](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines/rvalue-reference-param-not-moved.html)
A newly introduced check to flag when an rvalue reference argument of a
function is never moved inside the function body.
⚠️ **Warning**: in order to have this check compatible with
[performance-move-const-arg](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/performance/move-const-arg.html)
I had to set `performance-move-const-arg.CheckTriviallyCopyableMove` to
`false` (specifically for the three methods in
`ablastr::utils::msg_logger` accepting
`std::vector<char>::const_iterator&& rit` arguments).

-
[misc-header-include-cycle](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/misc/header-include-cycle.html)
A newly introduced check to prevent cyclic header inclusions.

-
[modernize-type-traits](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/modernize/type-traits.html)
A newly introduced check. The idea is to replace currencies of, e.g.,
`std::is_integral<T>::value`, with the less verbose alternative
`std::is_integral_v<T>`

-
[performance-avoid-endl](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/performance/avoid-endl.html)
A newly introduced check. The idea is to replace `<< std::endl` with
`\n`, since `endl` also forces a flush of the stream. In few cases
flushing the buffer is actually the desired behavior. Typically, this
happens when we want to write to `std::cerr`, which is however
automatically flushed after each write operation. In cases where
actually flushing to `std::cout` is the desired behavior one can do `<<
\n << std::flush `, which is arguably more transparent than `<<
std::endl`.

-
[performance-noexcept-swap](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/performance/noexcept-swap.html)
For performance reasons it is better if `swap` functions are declared as
`noexcept`, in order to allow the compiler to perform more aggressive
optimizations. In any case, we can use the AMReX function `amrex::Swap`,
which is `noexcept`.

### 🔄 Re-enabled checks:

-
[readability-misleading-indentation](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/readability/misleading-indentation.html)
This check was already available in v16, but a bug led to false
positives. The bug has been corrected in v17 of the tool, so we can
re-enable the check.

### ⛔ The PR excludes the following checks :

-
[cppcoreguidelines-missing-std-forward](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/cppcoreguidelines/missing-std-forward.html)
A newly introduced check that warns when a forwarding reference
parameter is not forwarded. In order to comply with this check I think
that I have to pass some parameters by reference to lambda functions
inside `ParallelFor` constructs. However, this leads to issues when we
compile for GPUs. Therefore, I think that the best solution is to
exclude this check. See an example below (for `PredFunc&& filter` ):
```
amrex::ParallelForRNG(np,
    [=,&filter] AMREX_GPU_DEVICE (int i, amrex::RandomEngine const& engine)
    {
        p_mask[i] = filter(src_data, i, engine);
    });
``` 

-
[misc-include-cleaner](https://releases.llvm.org/17.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/misc/include-cleaner.html)
It would be awesome to include this check. However, as it is now
implemented, it has no notion of "associated headers". For instance,
let's suppose that the header `MyClass.H` has `#include<string>` and
that `MyClass.cpp` has `#include "MyClass.H"` and uses `std:string`
somewhere. In this case, the check raises a warning stating that you
should include `<string>` in `MyClass.cpp` even if it is transitively
included via the associate header `MyClass.H` . For this reason, for the
moment, it is better to periodically check headers with the `IWYU` tool.
…CP-WarpX#5579)

This PR moves the initialization of the warning manager from the very
large `ReadParameters` function of the WarpX class to a free function
inside `WarpXInit.H/cpp` . This function is now called by the
constructor of the WarpX class.

The final goal is to simplify the WarpX class.
….cpp (ECP-WarpX#5609)

This PR moves the static function `shiftMF` from the WarpX class to an
anonymous namespace in `WarpXMovingWindow.cpp`, where it is actually
used.
This is done to simplify the Warpx class.
Weekly update to latest AMReX.
Weekly update to latest pyAMReX.
Weekly update to latest PICSAR (no changes).

```console
./Tools/Release/updateAMReX.py
./Tools/Release/updatepyAMReX.py
./Tools/Release/updatePICSAR.py
```

---------

Signed-off-by: Axel Huebl <axel.huebl@plasma.ninja>
Co-authored-by: Weiqun Zhang <weiqunzhang@lbl.gov>
This PR transforms the WarpX member functions `MarkReducedShapeCells`,
`MarkUpdateCellsStairCase`, `MarkUpdateECellsECT`,
`MarkUpdateBCellsECT`, `MarkExtensionCells` into pure functions inside
the namespace `warpx::embedded_boundary`, together with
`ComputeEdgeLengths`, `ComputeFaceAreas`, `ScaleEdges`, and
`ScaleAreas`. The source files containing these functions are renamed as
`EmbeddedBoundaryInit.H/cpp` , since these functions are called only
during the initialization.
…to&` (ECP-WarpX#5656)

This PR simplifies the return type of a method of the WarpX class by
replacing:
```
#   ifdef WARPX_DIM_RZ
        SpectralSolverRZ&
#   else
        SpectralSolver&
#   endif
```
with
```
auto&
```
Adds a luminosity diagnostic differentiated in the energies of two
colliding species, called `DifferentialLuminosity2D`.
It is defined as follows:
```math
\begin{align*}
\frac{d^2\mathcal{L}}{dE_1 dE_2}(E_1, E_2, t)  = \int_0^t dt'\int d\boldsymbol{x}\, & \int d\boldsymbol{p}_1 \int d\boldsymbol{p}_2\; \sqrt{ |\boldsymbol{v}_1 - \boldsymbol{v}_2|^2 - |\boldsymbol{v}_1\times\boldsymbol{v}_2|^2/c^2} \\ 
& f_1(\boldsymbol{x}, \boldsymbol{p}_1, t')f_2(\boldsymbol{x}, \boldsymbol{p}_2, t') \delta(E_1 - E_1(\boldsymbol{p}_1) \delta( E_2 - E_2(\boldsymbol{p}_2))
\end{align*}
```
where:
*  $\boldsymbol{p}_i$ is the momentum of a particle of species $i$
* $E_i$ is the energy of a particle of species $i$, $E_i
(\boldsymbol{p}_i) = \sqrt{m_1^2c^4 + c^2 |\boldsymbol{p}_i|^2}$
* $f_i$ is the distribution function of species $i$, normalized such
that $\int \int f(\boldsymbol{x} \boldsymbol{p}, t )d\boldsymbol{x}
d\boldsymbol{p} = N$, the number of particles in species $i$ at time $t$

The 2D differential luminosity is given in units of $\text{m}^{-2} \
\text{eV}^{-2}$.

The user must specify the minimum, maximum, and number of bins to
discretize the $E_1$ and $E_2$ axes.
The computation of this diagnostic is similar to that of
`ParticleHistogram2D`.
 
The output is a folder containing a set of openPMD files.
The values of the diagnostic are stored in a record labeled
`d2L_dE1_dE2`, with axes `E1` and `E2`.

---------

Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
…-WarpX#5644)

`SetDotMask`, a member function of the WarpX class, is only used inside
the member function `getFieldDotMaskPointer` . This PR turns it into a
pure function and moves it into an anonymous namespace inside
`WarpX.cpp`.
This (slightly) simplifies the WarpX class header.
Update to latest AMReX version to pull the latest bug fix in
AMReX-Codes/amrex#4333.
This PR allows for the addition of external fields through the particle
fields analytical interface. This is useful for field splitting external
vs. self fields in the hybrid ohm's law solver.

---------

Signed-off-by: S. Eric Clark <25495882+clarkse@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Roelof Groenewald <40245517+roelof-groenewald@users.noreply.github.com>
This is a temporary fix, setting a boundary condition for the Curl-Curl
preconditioner for the implicit solver. This now sets the BC to
Dirichlet for the PEC regions. A correct solution would have to be
implemented in the curl-curl solver because of the split between the PEC
and insulator sections.
- [x] profile: avoid repetition, use `SW_DIR` variable as in
`install_...` scripts
- [x] move from CFS to PSCRATCH (more stable, faster, where the binary
lives); uses an undocumented, purge-exempt location for container
images/software
- [x] build our own boost (SW stack consistency)
- [x] get our own CCache (prior one is gone)
- [x] RT tested
As said in the title, this is just a small PR to make the
`HybridPICSolveE` kernels more readable.

---------

Signed-off-by: roelof-groenewald <regroenewald@gmail.com>
…ev) and doQEDEvents with doQEDEvents(lev) (ECP-WarpX#5671)

`doFieldIonization(lev) ` is called only once, inside
`doFieldIonization` , which is simply a loop over the levels calling for
each level `doFieldIonization(lev) `. The same happens for
`doQEDEvents`.

In order to simplify the interface of the WarpX class, I would like to
propose to drop `doFieldIonization(lev) ` and `doQEDEvents(lev) `, and
to integrate their code respectively in `doFieldIonization` and
`doQEDEvents`.
…arpX#5670)

`AverageAndPackFields` and `prepareFields` are not implemented.
Therefore, this PR removes their declaration from the WarpX header.
The box metadata used in this script follows the AMReX conventions. We
want "zyx" in 3D and "yx" in 2D.
…tData.cpp (ECP-WarpX#5658)

`PrintDtDxDyDz` is used only twice in `WarpXInitData.cpp`. Therefore,
this PR turns it from a method of the WarpX class to a simple function
inside an anonymous namespace in `WarpXInitData.cpp`
Weekly update to latest AMReX.
Weekly update to latest pyAMReX (no changes).
Weekly update to latest PICSAR (no changes).

```console
./Tools/Release/updateAMReX.py
./Tools/Release/updatepyAMReX.py
./Tools/Release/updatePICSAR.py
```

This pulls in AMReX-Codes/amrex#4337, fixing
regressions from ECP-WarpX#5669 (GPU segfaults on particle redistribute)

Signed-off-by: Axel Huebl <axel.huebl@plasma.ninja>
…-WarpX#5685)

`NodalSyncJ` and `NodalSyncRho` are member functions of the WarpX class,
but they are never used. Therefore, this PR removes them.
Changes in Perlmutter GPU job script:
from `#SBATCH --cpus-per-task=16` to `#SBATCH --cpus-per-task=32`.

This is to request (v)cores in consecutive blocks.

GPU 3 is closest to CPU cores 0-15, 64-79, 
GPU 2 to CPU cores 16-31, 80-95, 
...

If `--cpus-per-task=16`, MPI ranks 0 and 1 are mapped to cores 0 and 8.
If `--cpus-per-task=32`, MPI ranks 0 and 1 are mapped to cores 0 and 16.

Visual representation

![pm_gpu_vcores_mpi](https://github.com/user-attachments/assets/edf0721f-7321-49ab-bf37-4b55a7c422cc)

---------

Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.