Skip to content

Commit 7551c90

Browse files
Documentation improvements
1 parent dd35d46 commit 7551c90

File tree

5 files changed

+153
-142
lines changed

5 files changed

+153
-142
lines changed
File renamed without changes.

src/IntegrateChebyshev.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ using FFTW # To perform discrete sine transform
22

33

44
# Bring in the prefactors
5-
include("Chebyshev/Precompute.jl")
5+
include("Chebyshev/PrecomputeChebyshev.jl")
66

77
# Bring in the integration tools
88
include("Chebyshev/Chebyshev.jl")

src/IntegrateLegendre.jl

Lines changed: 68 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,31 @@
33
using FastGaussQuadrature
44

55
# Bring in the prefactors
6-
include("Legendre/Precompute.jl")
6+
include("Legendre/PrecomputeLegendre.jl")
77

88
# Bring in the integration tools
99
include("Legendre/Legendre.jl")
1010

1111

12+
"""compute_aLegendre
1213
14+
for all values of u:
15+
compute a_k(u) by looping over Legendre weights w(u), P_k(u) values, and G(u) values.
16+
17+
parallel or non-parallel options
18+
"""
1319
function compute_aLegendre(tabwGLquad::Vector{Float64},
1420
tabG::Vector{Float64},
1521
tabPGLquad::Matrix{Float64},
1622
tabINVcGLquad::Vector{Float64},
17-
PARALLEL::Bool)
18-
#=
19-
Function that pre-computes the coefficients a
20-
using the G-L quadrature
21-
=#
23+
PARALLEL::Bool=true)
24+
2225
K_u = size(tabwGLquad, 1)
2326

2427
taba = zeros(Float64,K_u)
2528

29+
if (PARALLEL) # If the calculation is made in parallel
2630

27-
if (PARALLEL) # The calculation is made in parallel
2831
Threads.@threads for k=0:(K_u-1) # Loop over the Legendre functions
2932
res = 0.0 # Initialisation of the result
3033
for i=1:K_u # Loop over the G-L nodes
@@ -34,10 +37,12 @@ function compute_aLegendre(tabwGLquad::Vector{Float64},
3437
res += w*G*P # Update of the sum
3538
end
3639
res *= tabINVcGLquad[k+1] # Multiplying by the prefactor. ATTENTION, to the shift of the array
37-
#####
40+
3841
taba[k+1] = res # Filling in taba. ATTENTION, to the shift of the array
3942
end
40-
else # The calculation is not made in parallel
43+
44+
else # If the calculation is not made in parallel...
45+
4146
for k=0:(K_u-1) # Loop over the Legendre functions
4247
res = 0.0 # Initialisation of the result
4348
for i=1:K_u # Loop over the G-L nodes
@@ -47,17 +52,22 @@ function compute_aLegendre(tabwGLquad::Vector{Float64},
4752
res += w*G*P # Update of the sum
4853
end
4954
res *= tabINVcGLquad[k+1] # Multiplying by the prefactor. ATTENTION, to the shift of the array
50-
#####
55+
5156
taba[k+1] = res # Filling in taba. ATTENTION, to the shift of the array
5257
end
58+
5359
end
5460

5561
return taba
5662

5763
end
5864

5965

66+
"""get_Legendre_IminusXi
67+
68+
perform the loop calculation a_k*D_k, after computing D_k
6069
70+
"""
6171
function get_Legendre_IminusXi(omg::Complex{Float64},
6272
taba::Vector{Float64},
6373
xmax::Float64,
@@ -75,47 +85,24 @@ function get_Legendre_IminusXi(omg::Complex{Float64},
7585

7686
# Computing the Hilbert-transformed Legendre functions
7787
get_tabLeg!(varpi,K_u,struct_tabLeg,LINEAR)
78-
tabDLeg = struct_tabLeg.tabDLeg # Name of the array where the D_k(w) are stored
79-
#####
80-
xi = 0.0 + 0.0*im # Initialisation of the xi
88+
#tabDLeg = struct_tabLeg.tabDLeg # Name of the array where the D_k(w) are stored
8189
#####
90+
91+
xi = 0.0 + 0.0*im # Initialise xi
8292
for k=0:(K_u-1) # Loop over the Legendre functions
83-
xi += taba[k+1]*tabDLeg[k+1] # Adding a contribution. ATTENTION, to the shift of the array.
93+
xi += taba[k+1]*struct_tabLeg.tabDLeg[k+1] # Adding a contribution. ATTENTION, to the shift of the array.
8494
end
85-
#####
86-
IminusXi = 1.0 - xi # Computing the value of 1.0 - xi
95+
96+
IminusXi = 1.0 - xi # Compute 1.0 - xi
8797
return IminusXi # Output
8898
end
8999

90-
function test_ninepointsL(taba::Vector{Float64},
91-
xmax::Float64,
92-
struct_tabLeg::struct_tabLeg_type,
93-
digits::Int64=4)
94-
#=function to test nine unique points for values of D_k
95100

96-
=#
97-
upperleft = -1.5 + 1.5im
98-
uppercen = 0.0 + 1.5im
99-
upperright = 1.5 + 1.5im
100-
midleft = -1.5 + 0.0im
101-
midcen = 0.0 + 0.0im
102-
midright = 1.5 + 0.0im
103-
lowerleft = -1.5 - 1.5im
104-
lowercen = 0.0 - 1.5im
105-
lowerright = 1.5 - 1.5im
106-
107-
println(round(get_Legendre_IminusXi(upperleft,taba,xmax,struct_tabLeg,"unstable"),digits=digits)," || ",
108-
round(get_Legendre_IminusXi(uppercen,taba,xmax,struct_tabLeg,"unstable"),digits=digits)," || ",
109-
round(get_Legendre_IminusXi(upperright,taba,xmax,struct_tabLeg,"unstable"),digits=digits))
110-
println(round(get_Legendre_IminusXi(midleft,taba,xmax,struct_tabLeg,"neutral"),digits=digits)," || ",
111-
round(get_Legendre_IminusXi(midcen,taba,xmax,struct_tabLeg,"neutral"),digits=digits)," || ",
112-
round(get_Legendre_IminusXi(midright,taba,xmax,struct_tabLeg,"neutral"),digits=digits))
113-
println(round(get_Legendre_IminusXi(lowerleft,taba,xmax,struct_tabLeg,"damped"),digits=digits)," || ",
114-
round(get_Legendre_IminusXi(lowercen,taba,xmax,struct_tabLeg,"damped"),digits=digits)," || ",
115-
round(get_Legendre_IminusXi(lowerright,taba,xmax,struct_tabLeg,"damped"),digits=digits))
116-
end
101+
"""compute_tabIminusXi
117102
103+
wrapper to parallelise calculations of I-Xi
118104
105+
"""
119106
function compute_tabIminusXi(tabomega::Vector{Complex{Float64}},
120107
taba::Vector{Float64},
121108
xmax::Float64,
@@ -145,7 +132,11 @@ function compute_tabIminusXi(tabomega::Vector{Complex{Float64}},
145132

146133
end
147134

135+
"""setup_legendre_integration
148136
137+
build various tables for integrating the plasma problem with Legendre
138+
139+
"""
149140
function setup_legendre_integration(K_u::Int64,qself::Float64,xmax::Float64,PARALLEL::Bool=false)
150141

151142
# Filling in the arrays used in the G-L quadrature (src/Precompute.jl)
@@ -163,3 +154,38 @@ function setup_legendre_integration(K_u::Int64,qself::Float64,xmax::Float64,PARA
163154
return taba,struct_tabLeg
164155

165156
end
157+
158+
159+
160+
"""
161+
162+
routine to test the different integration regimes for the plasma case
163+
164+
"""
165+
function test_ninepointsL(taba::Vector{Float64},
166+
xmax::Float64,
167+
struct_tabLeg::struct_tabLeg_type,
168+
digits::Int64=4)
169+
#=function to test nine unique points for values of D_k
170+
171+
=#
172+
upperleft = -1.5 + 1.5im
173+
uppercen = 0.0 + 1.5im
174+
upperright = 1.5 + 1.5im
175+
midleft = -1.5 + 0.0im
176+
midcen = 0.0 + 0.0im
177+
midright = 1.5 + 0.0im
178+
lowerleft = -1.5 - 1.5im
179+
lowercen = 0.0 - 1.5im
180+
lowerright = 1.5 - 1.5im
181+
182+
println(round(get_Legendre_IminusXi(upperleft,taba,xmax,struct_tabLeg,"unstable"),digits=digits)," || ",
183+
round(get_Legendre_IminusXi(uppercen,taba,xmax,struct_tabLeg,"unstable"),digits=digits)," || ",
184+
round(get_Legendre_IminusXi(upperright,taba,xmax,struct_tabLeg,"unstable"),digits=digits))
185+
println(round(get_Legendre_IminusXi(midleft,taba,xmax,struct_tabLeg,"neutral"),digits=digits)," || ",
186+
round(get_Legendre_IminusXi(midcen,taba,xmax,struct_tabLeg,"neutral"),digits=digits)," || ",
187+
round(get_Legendre_IminusXi(midright,taba,xmax,struct_tabLeg,"neutral"),digits=digits))
188+
println(round(get_Legendre_IminusXi(lowerleft,taba,xmax,struct_tabLeg,"damped"),digits=digits)," || ",
189+
round(get_Legendre_IminusXi(lowercen,taba,xmax,struct_tabLeg,"damped"),digits=digits)," || ",
190+
round(get_Legendre_IminusXi(lowerright,taba,xmax,struct_tabLeg,"damped"),digits=digits))
191+
end

0 commit comments

Comments
 (0)