Skip to content

Commit

Permalink
Merge pull request #135 from astro-group-bristol/fergus/no-base-refactor
Browse files Browse the repository at this point in the history
feat: remove GradusBase
  • Loading branch information
fjebaker authored Jul 27, 2023
2 parents 2772563 + c62cbea commit e3665ad
Show file tree
Hide file tree
Showing 36 changed files with 433 additions and 529 deletions.
1 change: 0 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ version = "0.4.12"
Buckets = "3235f445-51d8-4100-901d-5b23398ac3ab"
DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0"
DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Expand Down
1 change: 0 additions & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
6 changes: 1 addition & 5 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ makedocs(
"Parallelism and ensembles" => "parallelism.md",
"Special radii" => "special-radii.md",
],
"API" =>
[
"Gradus" => "api-documentation/Gradus.md",
"GradusBase" => "api-documentation/GradusBase.md",
] |> sort,
"API" => ["Gradus" => "api-documentation/Gradus.md"] |> sort,
],
)

Expand Down
1 change: 1 addition & 0 deletions docs/src/api-documentation/Gradus.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ CurrentModule = Gradus
```

```@docs
StatusCodes
tracegeodesics
inverse_metric_components
Gradus.metric_jacobian
Expand Down
6 changes: 0 additions & 6 deletions docs/src/api-documentation/GradusBase.md

This file was deleted.

8 changes: 4 additions & 4 deletions docs/src/custom-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using Gradus
M = 1.0
end

function GradusBase.metric_components(m::EddingtonFinkelsteinAD{T}, rθ) where {T}
function Gradus.metric_components(m::EddingtonFinkelsteinAD{T}, rθ) where {T}
(r, θ) =
M = m.M

Expand All @@ -44,12 +44,12 @@ function GradusBase.metric_components(m::EddingtonFinkelsteinAD{T}, rθ) where {
(tt, rr, θθ, ϕϕ, T(0.0))
end

GradusBase.inner_radius(m::EddingtonFinkelsteinAD) = 2 * m.M
Gradus.inner_radius(m::EddingtonFinkelsteinAD) = 2 * m.M
```
A few notes:
- We use `@with_kw` from [Parameters.jl](https://github.com/mauro3/Parameters.jl) to define various utility constructors for us.
- [`GradusBase.metric_components`](@ref) must return five elements for [`AbstractStaticAxisSymmetric`](@ref), where the last element is the off-axis ``g_{t \phi}`` matrix element, which in this case is always 0.
- The [`GradusBase.inner_radius`](@ref) function defines the inner-radius of integration chart. This defines where the integration should terminate to avoid running indefinitely, and is, in this case, set to the event-horizon of our metric.
- [`metric_components`](@ref) must return five elements for [`AbstractStaticAxisSymmetric`](@ref), where the last element is the off-axis ``g_{t \phi}`` matrix element, which in this case is always 0.
- The [`inner_radius`](@ref) function defines the inner-radius of integration chart. This defines where the integration should terminate to avoid running indefinitely, and is, in this case, set to the event-horizon of our metric.

That's all we need! This metric is now ready to be traced in the usual way.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ end
Currently, Gradus.jl uses exclusively Boyer-Lindquist coordinates for its metrics. However, new coordinates can be implemented, and documentation for this will come soon.

```julia
GradusBase.inner_radius(m::KerrMetric) = 2 * m.M
Gradus.inner_radius(m::KerrMetric) = 2 * m.M
```

- Finally, we specify some inner radius for the integration. This is the cutoff around the origin at which radius the geodesic integration will stop to avoid numerical errors. Here, it is just the Schwarzschild radius, or the outer event horizon. Gradus.jl can calculate different horizons from the metric automatically, which can be useful if you don't know the solution ahead of time, or if the solution is non-symmetric in $\theta$. But if we know it, we can benefit from a small performance boost by implementing it directly.
Expand Down
Loading

0 comments on commit e3665ad

Please sign in to comment.