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

Add reduced diagnostic: 2d differential luminosity #5545

Merged
merged 14 commits into from
Feb 14, 2025

Conversation

aeriforme
Copy link
Member

@aeriforme aeriforme commented Jan 9, 2025

Adds a luminosity diagnostic differentiated in the energies of two colliding species, called DifferentialLuminosity2D.
It is defined as follows:

$$\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.

@aeriforme aeriforme marked this pull request as ready for review January 14, 2025 03:33
@aeriforme aeriforme requested a review from RemiLehe January 14, 2025 03:33
@aeriforme aeriforme changed the title [WIP] Add reduced diagnostic: 2d differential luminosity Add reduced diagnostic: 2d differential luminosity Jan 14, 2025
@ax3l ax3l added the component: diagnostics all types of outputs label Jan 22, 2025
@@ -1,6 +1,6 @@
# Add tests (alphabetical order) ##############################################
#

if(WarpX_FFT)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional? It seems unrelated to the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is intentional.
This example requires the compilation flag -DWarpX_FFT=ON.
Without this, the related ctest would fail.

Note that this has not been a problem in CI so far because the FFT compilation flag is on.

print("Relative error: ", error1)
print("Tolerance: ", tol1)

# Check that the 2D and 1D diagnostics match
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, a stronger test would be to compute d2L_dE1_dE2_th and to compare the values.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right.

@RemiLehe RemiLehe enabled auto-merge (squash) February 13, 2025 23:28
@RemiLehe RemiLehe merged commit eb26277 into ECP-WarpX:development Feb 14, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: diagnostics all types of outputs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants