You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: test/derivative_operators_interface.jl
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -146,55 +146,56 @@ end
146
146
147
147
@testset"Correctness of Non-Uniform Stencils"begin
148
148
x = [0., 0.08, 0.1, 0.15, 0.19, 0.26, 0.29]
149
+
nx =length(x)
149
150
dx =diff(x)
150
151
151
152
# Second-Order First Derivative
152
-
L =CenteredDifference(1, 2, dx, 5)
153
+
L =CenteredDifference(1, 2, dx, nx-2)
153
154
correct =analyticCtrOneTwoIrr()
154
155
155
156
# Check that stencils agree with correct
156
157
for (i,coefs) inenumerate(L.stencil_coefs)
157
158
@testArray(coefs) ≈ correct[i,correct[i,:] .!=0.]
158
159
end
159
-
@test_brokenArray(L) ≈ correct# All of these concretizations
160
-
@test_brokensparse(L) ≈ correct# only give the first three
161
-
@test_brokenBandedMatrix(L) ≈ correct# rows of the computed stencil coefficients
160
+
@testArray(L) ≈ correct
161
+
@testsparse(L) ≈ correct
162
+
@testBandedMatrix(L) ≈ correct
162
163
163
164
# Second-Order Second Derivative
164
-
L =CenteredDifference(2, 2, dx, 5)
165
+
L =CenteredDifference(2, 2, dx, nx-2)
165
166
correct =analyticCtrTwoTwoIrr()
166
167
167
168
# Check that stencils agree with correct
168
169
for (i,coefs) inenumerate(L.stencil_coefs)
169
170
@testArray(coefs) ≈ correct[i,correct[i,:] .!=0.]
170
171
end
171
-
@test_brokenArray(L) ≈ correct# same issue as previous derivative
172
-
@test_brokensparse(L) ≈ correct
173
-
@test_brokenBandedMatrix(L) ≈ correct
172
+
@testArray(L) ≈ correct
173
+
@testsparse(L) ≈ correct
174
+
@testBandedMatrix(L) ≈ correct
174
175
175
176
# Fourth-Order Second Derivative
176
-
L =CenteredDifference(2, 4, dx, 5)
177
+
L =CenteredDifference(2, 4, dx, nx-2)
177
178
correct =analyticCtrTwoFourIrr()
178
179
179
180
# Check that stencils agree with correct
180
181
for (i,coefs) inenumerate(L.stencil_coefs)
181
182
@testArray(coefs) ≈ correct[i,correct[i,:] .!=0.]
182
183
end
183
-
@test_brokenArray(L)≈ correct # L.stencil_coefs is populated, but the concretization doesn't work. It appears to be an issue of improper calculation of indexing from the various lengths computed during construction (e.g. boundary_stencil_length, len) and potentially the fact that "len" doesn't seem to specify the number of grid points at which we compute finite differences but appears to specify the location of the last grid point at which we compute finite differences (so if X is a 5-length vector, entering len = 2 means computing FDs for X[2] and X[3])
0 commit comments