Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand Down Expand Up @@ -57,14 +58,11 @@ QuadGK = "2.11.3"
Roots = "2.2.13"
SparseArrays = "1"
SpecialFunctions = "2.5.1"
Random = "1"
StaticArrays = "1.9.15"
Statistics = "1"
TOML = "1"
Test = "1"
julia = "1.11"

[extras]
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[targets]
test = ["Random"]
41 changes: 30 additions & 11 deletions src/InnerLayer/GGJ/GGJ.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
# GGJ.jl
#
# Glasser–Greene–Johnson resistive inner-layer model. Provides two
# Glasser–Greene–Johnson resistive inner-layer model. Provides three
# interchangeable solvers selected via the `solver` type-parameter of
# `GGJModel`:
#
# - `:shooting` – stable backward shoot from X_max → 0 (Phase 3)
# - `:galerkin` – Hermite-cubic finite element method (Phase 4)
# - `:shooting` – stable backward shoot from X_max → 0;
# numerically stable only for |Q| ≪ 1, should not be used
# - `:galerkin` – Hermite-cubic finite element method;
# real-axis method, degrades for |Q| ≳ 1 off the real axis
# - `:ray` – rotated-contour spectral-element collocation (Ray.jl);
# robust to |Q| ~ 500 on/near the imaginary axis
#
# Both solvers share the same `inps` Wasow asymptotic-basis kernel
# (`InnerAsymptotics.jl`) for the large-x boundary condition. They return
# the parity-projected matching data `(Δ_odd, Δ_even)` of GWP2016 Eqs. (34)–(35).
# All solvers share the same `inps` Wasow asymptotic-basis kernel
# (`InnerAsymptotics.jl`, complex-x extension in `RayAsymptotics.jl`) for the
# large-x boundary condition. They return the parity-projected matching data
# `(Δ_odd, Δ_even)` of GWP2016 Eqs. (34)–(35) in the same (deltac) convention.
#
# Equation references throughout this module use two source papers:
#
Expand All @@ -31,32 +36,46 @@ module GGJ

using LinearAlgebra
using StaticArrays
using SparseArrays
using Random
using Printf
using DoubleFloats: Double64

import ..InnerLayerModel, ..solve_inner

"""
GGJModel{S} <: InnerLayerModel

Glasser–Greene–Johnson resistive inner-layer model. The type parameter `S`
selects the solver: `:galerkin` (default) for the Hermite-cubic finite element
solver and `:shooting` for the backward stable-shoot solver. Both
implementations consume the same `inps` asymptotic-basis kernel and return
the parity-projected matching data.
selects the solver: `:ray` (default) for the rotated-contour collocation
solver (robust at large |Q| on/near the imaginary axis; agrees with
`:galerkin` within its error bar at moderate Q), `:galerkin` for the
Hermite-cubic finite element solver (real-axis method; degrades for
|Q| ≳ 1), and `:shooting` for the backward stable-shoot solver (|Q| ≪ 1
only). All implementations consume the same `inps` asymptotic-basis kernel
and return the parity-projected matching data in the same convention.
Note the backends take different numerical-knob keywords: pass
`GGJModel(solver=:galerkin)` explicitly when using `nx`/`xfac`-style
Galerkin knobs.
"""
struct GGJModel{S} <: InnerLayerModel end

GGJModel(; solver::Symbol=:galerkin) = GGJModel{solver}()
GGJModel(; solver::Symbol=:ray) = GGJModel{solver}()

include("GGJParameters.jl")
include("InnerAsymptotics.jl")
include("RayAsymptotics.jl")
include("Reference.jl")
include("Shooting.jl")
include("Galerkin.jl")
include("Ray.jl")

export GGJModel, GGJParameters
export mercier_di, mercier_dr, inner_Q, rescale_delta
export build_asymptotics, evaluate_asymptotics, pick_xmax
export InnerAsymptoticsCache
export glasser_wang_2020_eq55
export solve_ray, RaySolveResult, pick_smax, physical_ua_dua
export delta_convergence, solution_profile, asymptotic_profile, q4_surface_benchmark

end # module GGJ
Loading
Loading