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

Debugging coronal beaming emissivities #148

Merged
merged 26 commits into from
Aug 24, 2023
Merged

Debugging coronal beaming emissivities #148

merged 26 commits into from
Aug 24, 2023

Conversation

fjebaker
Copy link
Member

@fjebaker fjebaker commented Aug 23, 2023

This PR is primarily in relation to trying to work out what's going on with the emissivity profiles when we have a moving source. @wiktoriatarnopolska has added the model from the literature (e.g. Wilkins+12, Dauser+13, Gonzalez+17; PR pending):

# structing a moving source
struct MovingSource{T} <: Gradus.AbstractCoronaModel{T}
    r::T
    β::T
end

# helper functions
drdt(g, β) = β * (-g[1] / g[2])
drdt(m::AbstractMetric, x, β) = drdt(metric_components(m, SVector(x[2], x[3])), β)
function Gradus.sample_position_velocity(m::AbstractMetric, model::MovingSource)
    x = SVector{4}(0, model.r, 1e-4, 0)
    v = SVector(1, drdt(m, x, model.β), 0, 0)
    x, v
end

# blazing fast, exploiting symmetry
Gradus.emissivity_profile(
    ::Nothing,
    m::AbstractMetric,
    d::AbstractAccretionDisc,
    model::MovingSource,
    spec::Gradus.AbstractCoronalSpectrum;
    kwargs...,
) = Gradus._point_source_symmetric_emissivity_profile(m, d, model, spec; kwargs...)

This PR adds utility functions and small little changes that attempts to help get some kind of consensus between the results published in the literature. I will use the comments in this PR to document progress.

Relevant figures from the literature:

Wilkins+12 Figure 11:

Screenshot 2023-08-24 at 10 49 44

Dauser+13 Figure 6:

Screenshot 2023-08-24 at 10 02 51

Gonzalez+17 Fig 6:

Screenshot 2023-08-24 at 10 49 57

@codecov-commenter
Copy link

codecov-commenter commented Aug 23, 2023

Codecov Report

Merging #148 (01c0159) into main (50015ff) will decrease coverage by 0.74%.
Report is 21 commits behind head on main.
The diff coverage is 60.43%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##             main     #148      +/-   ##
==========================================
- Coverage   68.81%   68.07%   -0.74%     
==========================================
  Files          58       59       +1     
  Lines        2559     2622      +63     
==========================================
+ Hits         1761     1785      +24     
- Misses        798      837      +39     
Files Changed Coverage Δ
src/Gradus.jl 26.08% <0.00%> (-6.53%) ⬇️
src/metrics/minkowski.jl 0.00% <0.00%> (ø)
src/plotting-recipes.jl 0.00% <0.00%> (ø)
src/tracing/method-implementations/first-order.jl 70.21% <0.00%> (ø)
src/tracing/constraints.jl 72.72% <40.00%> (-27.28%) ⬇️
src/corona/flux-calculations.jl 32.55% <75.00%> (-4.66%) ⬇️
src/orbits/circular-orbits.jl 73.61% <84.61%> (+1.94%) ⬆️
src/corona/profiles/radial.jl 90.90% <85.00%> (+5.45%) ⬆️
src/corona/emissivity.jl 93.75% <100.00%> (+0.13%) ⬆️
src/corona/models/lamp-post.jl 100.00% <100.00%> (ø)
... and 6 more

... and 1 file with indirect coverage changes

@fjebaker
Copy link
Member Author

Ostensibly, all of these authors are using the same beaming model, where the source velocity is described as

$$ v_\text{source}^\mu = \left( 1, \beta \frac{\text{d} r }{\text{d} t}, 0, 0 \right), $$

where $\beta$ is the coronal velocity.

Gonzalez+17 derive $\text{d} r / \text{d} t$ from $\text{d}s^2 = 0$ for $\text{d} \theta = \text{d} \phi = 0$, and therefore

$$ \frac{\text{d} r}{\text{d} t} = \sqrt{\frac{g_{tt}}{g_{rr}}}. $$

This $\text{d} r / \text{d} t$ is the coordinate velocity in a ZAMO frame co-located with the corona. A tetrad basis is then constructed from this velocity, with the seed vector

$$ \mathbf{e}^\mu_{(t)} = \sqrt{\frac{1}{g_{tt} + v^2 g_{rr}}} \left( 1, v, 0, 0 \right), $$

using the shorthand $v = \beta \text{d} r / \text{d} t$.

... I just noticed we are missing that normalization in the velocity prescription of the MovingSource model.

@fjebaker
Copy link
Member Author

With the normalization on the velocity, i.e.

function Gradus.sample_position_velocity(m::AbstractMetric, model::MovingSource)
    x = SVector{4}(0, model.r, 1e-4, 0)
    g = metric_components(m, SVector(x[2], x[3]))
    u = drdt(g, model.β)
    v = (inv(-g[1] - u^2 * g[2])) .* SVector(1, u, 0, 0)
    x, v
end

Screenshot 2023-08-24 at 11 18 52

Without:

Screenshot 2023-08-24 at 11 19 49

Clearly the normalization corrects for the difference between the $\beta = 0$ and LP case, which is nice 👍

@fjebaker
Copy link
Member Author

fjebaker commented Aug 24, 2023

Note the fact that ours do not quite asymptotically go to $\alpha = 3$ is because I am only using a few thousand samples to keep computation time really short whilst I debug. Increasing samples fixes the large $r$ behaviour.

@fjebaker fjebaker changed the title Adding some debug toolkit things Debugging coronal beaming emissivities Aug 24, 2023
@fjebaker
Copy link
Member Author

fjebaker commented Aug 24, 2023

Recreating Fig 8 from Fukumura & Kazanas 2007:

Screenshot 2023-08-24 at 13 08 40

Ours:
Screenshot 2023-08-24 at 13 11 44

I had to guess the number of geodesics but it turns out it is exactly 37.

@fjebaker fjebaker merged commit 65b92e9 into main Aug 24, 2023
1 check passed
@fjebaker fjebaker deleted the fergus/debug-kit branch August 24, 2023 21:10
@fjebaker
Copy link
Member Author

  • The difference the velocity normalization makes:

Screenshot 2023-08-25 at 11 14 38

  • Vs not normalizing:

Screenshot 2023-08-25 at 11 14 33

@fjebaker fjebaker mentioned this pull request Sep 6, 2023
13 tasks
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.

2 participants