Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 3690385

Browse files
committed
.
1 parent 86ba7d7 commit 3690385

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

src/derivative_operators/derivative_operator.jl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,10 @@ function CenteredDifference{N}(derivative_order::Int,
163163
)
164164
end
165165

166-
struct CompleteCenteredDifference{N} end
167-
168166
"""
169167
A helper function to compute the coefficients of a derivative operator including the boundary coefficients in the centered scheme.
170168
"""
171-
function CompleteCenteredDifference{N}(derivative_order::Int,
169+
function CompleteCenteredDifference(derivative_order::Int,
172170
approximation_order::Int, dx::T,
173171
len::Int, coeff_func=1) where {T<:Real,N}
174172
@assert approximation_order>1 "approximation_order must be greater than 1."
@@ -209,11 +207,10 @@ end
209207

210208

211209
"""
212-
A helper function to compute the coefficients of a derivative operator including the boundary coefficients in the half centered scheme. See table 2 in https://web.njit.edu/~jiang/math712/fornberg.pdf
210+
A helper function to compute the coefficients of a derivative operator including the boundary coefficients in the half offset centered scheme. See table 2 in https://web.njit.edu/~jiang/math712/fornberg.pdf
213211
"""
214212
function CompleteHalfCenteredDifference(derivative_order::Int,
215-
approximation_order::Int, dx::T,
216-
len::Int, isforward=false) where {T<:Real,N}
213+
approximation_order::Int, dx::T) where {T<:Real,N}
217214
@assert approximation_order>1 "approximation_order must be greater than 1."
218215
stencil_length = approximation_order + 2*floor(derivative_order/2) + 2*(approximation_order%2)
219216
centered_stencil_length = derivative_order + approximation_order - 1 + (derivative_order+approximation_order)%2
@@ -234,7 +231,7 @@ function CompleteHalfCenteredDifference(derivative_order::Int,
234231

235232
stencil_coefs = convert(SVector{stencil_length, T}, (1/dx^derivative_order) * calculate_weights(derivative_order, zero(T), dummy_x))
236233
# For each boundary point, for each tappoint in the half offset central difference stencil, we need to calculate the coefficients for the stencil.
237-
_low_boundary_coefs = [convert(SVector{centered_stencil_length}, SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, (1/dx^derivative_order) * calculate_weights(derivative_order, oneunit(T)*x0+offset, left_boundary_x)) for offset in xoffset]) for x0 in L_boundary_deriv_spots]
234+
_low_boundary_coefs = [Dict([offset => convert(SVector{boundary_stencil_length, T}, (1/dx^derivative_order) * calculate_weights(derivative_order, oneunit(T)*x0+offset, left_boundary_x)) for offset in xoffset]) for x0 in L_boundary_deriv_spots]
238235
low_boundary_coefs = convert(SVector{boundary_point_count},vcat(_low_boundary_coefs))
239236

240237
# _high_boundary_coefs = SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, (1/dx^derivative_order) * calculate_weights(derivative_order, oneunit(T)*x0, reverse(right_boundary_x))) for x0 in R_boundary_deriv_spots]
@@ -384,14 +381,12 @@ function UpwindDifference{N}(derivative_order::Int,
384381
)
385382
end
386383

387-
struct CompleteUpwindDifference{N} end
388-
389384
"""
390385
A helper function to compute the coefficients of a derivative operator including the boundary coefficients in the upwind scheme.
391386
"""
392-
function CompleteUpwindDifference{N}(derivative_order::Int,
387+
function CompleteUpwindDifference(derivative_order::Int,
393388
approximation_order::Int, dx::T,
394-
len::Int, coeff_func=1; offside::Int=0) where {T<:Real,N}
389+
offside::Int=0) where {T<:Real,N}
395390

396391
@assert offside > -1 "Number of offside points should be non-negative"
397392
@assert offside <= div(derivative_order + approximation_order - 1,2) "Number of offside points should not exceed the primary wind points"

0 commit comments

Comments
 (0)