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 phase integrals #59

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

steindev
Copy link
Member

Phase integrals are required to compute cross-sections in background fields. Integrals are defined in @szabo137's thesis eqs. (2.51)-(2.53).

Envisaged usage is as follows

  • Define a setup S which consists of a pulse envelope (shape and width/duration)
  • Define the method M used to compute the integrals (analytic, numeric)
    then computing the integrals depends on the chosen direction (of polarization/observation) pol, the background intensity a0, the photon number parameter l, and the kinematic factors alpha
phase_integral_setup =PhaseIntegral(S, M)
compute_B1x(phase_integral_setup, pol, a0, l, alpha_1x, alpha_1y, alpha_2) # other directions and integrals are named accordingly

The parameters pol, a0, ... are defined somewhere else, i.e. previously in the cross-section computation and outside QEDfields.jl.

@steindev steindev added help wanted Extra attention is needed 06 - Feature-request Missing a feature or functionality labels Jan 29, 2025
@SimeonEhrig
Copy link
Member

@steindev Can you please rebase. Otherwise the CI does not work.

@steindev steindev force-pushed the topic-2024-10_phase-integrals branch from b06a255 to 6d95340 Compare January 30, 2025 09:07
Copy link
Member

@AntonReinhard AntonReinhard left a comment

Choose a reason for hiding this comment

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

Just some comments from my side. I can't say much about the physics going on.

```
where ``A^\\mu(\\varphi)`` is the background field, ``G(\\varphi,p, p^\\prime)`` is the [`phase function`](@ref), ``(p,p^\\prime)`` the given phase space point, and ``l`` the photon number parameter.
"""
function computeB1 end
Copy link
Member

Choose a reason for hiding this comment

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

We usually use snake_case for function names, so this should probably be compute_B1

Comment on lines +7 to +10
"""
Abstract base type for defining a method for phase integral computation.
"""
abstract type Method end
Copy link
Member

Choose a reason for hiding this comment

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

Please add the type/struct/function definition (or something close that gets the idea across) in the docs too.

Suggested change
"""
Abstract base type for defining a method for phase integral computation.
"""
abstract type Method end
"""
abstract type Method end
Abstract base type for defining a method for phase integral computation.
"""
abstract type Method end

Also I'm not sure if the names Method and Analytic are a bit too unspecialized.

Comment on lines +12 to +34
"""
Analytic method for phase integral computation.

Requires an existing implementation of analytic formulas for computing the
entities in the phase integrals.
"""
struct Analytic <: Method end

"""
Fully numerical method for phase integral computation based on QuadGK.
"""
struct QuadGK <: Method end

"""
Struct holding setup specific information to compute phase integrals.

ToDo: We mix physical and numerical aspects in this class.
This does not seem ideal to me (Klaus).
"""
struct PhaseIntegral{P<:AbstractPulsedPlaneWaveField, M<:Method}
pulse::P
method::M
end
Copy link
Member

Choose a reason for hiding this comment

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

This is implementation-related and should not go into the interfaces directory.

Comment on lines +24 to +28
# from QEDprocesses.jl/src/constants.jl
# TODO: we might want to move the constants.jl file to QEDbase? See also TODO in QEDprocesses.jl/src/processes/one_photon_compton/perturbative/cross_section.jl
const ALPHA = inv(137.035999074)
const ELEMENTARY_CHARGE = sqrt(4 * pi * ALPHA)
const ELEMENTARY_CHARGE_SQUARE = 4 * pi * ALPHA
Copy link
Member

Choose a reason for hiding this comment

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

I agree, but I think QEDcore would be a better place instead of QEDbase.

Comment on lines +30 to +38
# definite integral of PPW field
# TODO: Why does integration always start at 0?
@inline function _field_integral(
field::AbstractPulsedPlaneWaveField,
pol::AbstractPolarization,
phi::T
) where {T<:Real}
return quadgk(t -> amplitude(field, pol, t), 0.0, phi)[1]
end
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't these functions take a Method?

Suggested change
# definite integral of PPW field
# TODO: Why does integration always start at 0?
@inline function _field_integral(
field::AbstractPulsedPlaneWaveField,
pol::AbstractPolarization,
phi::T
) where {T<:Real}
return quadgk(t -> amplitude(field, pol, t), 0.0, phi)[1]
end
# definite integral of PPW field
# TODO: Why does integration always start at 0?
@inline function _field_integral(
::QuadGK,
field::AbstractPulsedPlaneWaveField,
pol::AbstractPolarization,
phi::T
) where {T<:Real}
return quadgk(t -> amplitude(field, pol, t), 0.0, phi)[1]
end

Comment on lines +117 to +119
include("zeroth_integral.jl")
include("first_integral.jl")
include("second_integral.jl")
Copy link
Member

Choose a reason for hiding this comment

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

Per the coding guidelines, we only use includes at the top-level, so these includes should be moved to the QEDfields.jl file.

Comment on lines +28 to +34
ToDo: We mix physical and numerical aspects in this class.
This does not seem ideal to me (Klaus).
"""
struct PhaseIntegral{P<:AbstractPulsedPlaneWaveField, M<:Method}
pulse::P
method::M
end
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't seem like a problem to me necessarily, at least there shouldn't be any overhead since method is only a singleton.

This struct is intended to become the main part for user-facing functions? In this case we should think about which (if any) parts of the functionality of the plane wave fields and the methods can be implemented as orthogonal interfaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
06 - Feature-request Missing a feature or functionality help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants