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

Commit 2c4700f

Browse files
committed
fixed the residual difference between low and high boundary stencils
1 parent f887cfc commit 2c4700f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/derivative_operators/derivative_operator.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function CenteredDifference{N}(derivative_order::Int,
3737
_low_boundary_coefs = SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, (1/dx^derivative_order) * calculate_weights(derivative_order, oneunit(T)*x0, left_boundary_x)) for x0 in L_boundary_deriv_spots]
3838
low_boundary_coefs = convert(SVector{boundary_point_count},_low_boundary_coefs)
3939

40-
_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]
41-
high_boundary_coefs = convert(SVector{boundary_point_count},reverse(_high_boundary_coefs))
40+
# _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]
41+
high_boundary_coefs = convert(SVector{boundary_point_count},reverse(map(reverse, _low_boundary_coefs)))
4242

4343
coefficients = coeff_func isa Nothing ? nothing : Vector{T}(undef,len)
4444
DerivativeOperator{T,N,false,T,typeof(stencil_coefs),
@@ -120,7 +120,7 @@ function UpwindDifference{N}(derivative_order::Int,
120120
stencil_coefs = convert(SVector{stencil_length, T}, calculate_weights(derivative_order, zero(T), dummy_x))
121121
_low_boundary_coefs = SVector{boundary_stencil_length, T}[convert(SVector{boundary_stencil_length, T}, calculate_weights(derivative_order, oneunit(T)*x0, boundary_x)) for x0 in boundary_deriv_spots]
122122
low_boundary_coefs = convert(SVector{boundary_point_count},_low_boundary_coefs)
123-
high_boundary_coefs = convert(SVector{boundary_point_count},reverse(SVector{boundary_stencil_length, T}[reverse(low_boundary_coefs[i]) for i in 1:boundary_point_count]))
123+
high_boundary_coefs = convert(SVector{boundary_point_count},reverse(map(reverse, _low_boundary_coefs)))
124124

125125
coefficients = Vector{T}(undef,len)
126126

0 commit comments

Comments
 (0)