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

Commit c6f45a5

Browse files
author
AndiMD
committed
Merge remote-tracking branch 'AndiMD/master'
2 parents d477f23 + 83a9b6c commit c6f45a5

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

src/derivative_operators/BC_operators.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ struct RobinBC{T, V<:AbstractVector{T}} <: AffineBC{T}
2828

2929
s = calculate_weights(1, one(U), Array(one(U):convert(U,order+1))) #generate derivative coefficients about the boundary of required approximation order
3030

31-
a_l = -s[2:end]./(αl*dx/βl + s[1])
32-
a_r = s[end:-1:2]./(αr*dx/βr - s[1]) # for other boundary stencil is flippedlr with *opposite sign*
31+
a_l = -βl*s[2:end]./(αl*dx + βl*s[1])
32+
a_r = βr*s[end:-1:2]./(αr*dx - βr*s[1]) # for other boundary stencil is flippedlr with *opposite sign*
3333

3434
b_l = γl/(αl+βl*s[1]/dx)
3535
b_r = γr/(αr-βr*s[1]/dx)

test/robin.jl

+19-17
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ for i in 1:5
152152

153153
end
154154

155-
# Construct 5 arbitrary RobinBC operators w/non-uniform grid
155+
# Test complex Robin BC, w/non-uniform grid
156156
al = rand(ComplexF64,5)
157157
bl = rand(ComplexF64,5)
158158
cl = rand(ComplexF64,5)
@@ -198,19 +198,21 @@ for j in 1:2
198198
end
199199
end
200200

201-
# Test Neumann and Dirichlet as special cases of RobinBC
202-
dx = [0.121, 0.783, 0.317, 0.518, 0.178]
203-
αC = (0.539 + 0.653im, 0.842 + 0.47im)
204-
αR = (0.045, 0.577)
205-
@test NeumannBC(αC, dx).b_l -0.065219 - 0.079013im
206-
@test DirichletBC(αR...).b_r 0.577
207-
@test DirichletBC(Float64, αC...) 0.123 # broken
208-
209-
@test Dirichlet0BC(Float64).a_r [-0.0,0.0]
210-
@test Neumann0BC(dx).a_r [0.3436293436293436]
211-
@test Neumann0BC(ComplexF64,dx).a_l [0.15453384418901658 + 0.0im]
212-
213-
@test NeumannBC(αC, first(dx)).b_r 0.101882 + 0.05687im
214-
@test Neumann0BC(first(dx)).a_r [1.0 - 0.0im]
215-
@test Neumann0BC(ComplexF64,first(dx)).a_l [1.0 + 0.0im]
216-
201+
# Test NeumannBC, DirichletBC as special cases of RobinBC
202+
let
203+
dx = [0.121, 0.783, 0.317, 0.518, 0.178]
204+
αC = (0.539 + 0.653im, 0.842 + 0.47im)
205+
αR = (0.045, 0.577)
206+
@test NeumannBC(αC, dx).b_l -0.065219 - 0.079013im
207+
@test DirichletBC(αR...).b_r 0.577
208+
@test DirichletBC(Float64, αC...).b_l 0.539 + 0.653im
209+
@test DirichletBC(Float64, αC...).a_r [-0.0 + 0.0im, 0.0 + 0.0im]
210+
211+
@test Dirichlet0BC(Float64).a_r [-0.0,0.0]
212+
@test Neumann0BC(dx).a_r [0.3436293436293436]
213+
@test Neumann0BC(ComplexF64,dx).a_l [0.15453384418901658 + 0.0im]
214+
215+
@test NeumannBC(αC, first(dx)).b_r 0.101882 + 0.05687im
216+
@test Neumann0BC(first(dx)).a_r [1.0 - 0.0im]
217+
@test Neumann0BC(ComplexF64,first(dx)).a_l [1.0 + 0.0im]
218+
end

0 commit comments

Comments
 (0)