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
Copy file name to clipboardExpand all lines: src/bcs/scratch.jl
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -4,57 +4,65 @@ using DiffEqOperators
4
4
"""
5
5
Inner function for `get_half_offset_weights_and_stencil` (see below).
6
6
"""
7
-
function_get_weights_and_stencil(D, I)
7
+
function_get_weights_and_stencil(D, I, len=0)
8
+
if len ==20
9
+
clip =false
10
+
else
11
+
clip =true
12
+
end
8
13
# k => i of itap -
9
14
# offset is important due to boundary proximity
10
15
# The low boundary coeffs has a heirarchy of coefficients following: number of indices from boundary -> which half offset point does it correspond to -> weights
11
16
if I <= (D.boundary_point_count)
12
17
println("low boundary")
13
18
weights = D.low_boundary_coefs[I]
19
+
weight = I
14
20
offset =1- I
15
21
Itap = [I + (i+offset) for i in0:(D.boundary_stencil_length-1)]
16
-
elseif I > (20- D.boundary_point_count)
22
+
elseif I > (len- D.boundary_point_count)
17
23
println("high boundary")
18
24
19
-
weights = D.high_boundary_coefs[20-I+1]
20
-
offset =20- I
21
-
Itap = [I + (i+offset) for i in (-D.boundary_stencil_length+1):1:0]
25
+
weights = D.high_boundary_coefs[len-I +!clip]
26
+
weight =-(len - I +!clip)
27
+
offset = len - I
28
+
Itap = [I + (i+offset+clip) for i in (-D.boundary_stencil_length+1):1:0]
22
29
else
23
30
println("interior")
24
-
31
+
weight =0
25
32
weights = D.stencil_coefs
26
33
Itap = [I + i for i in (1-div(D.stencil_length,2)):(div(D.stencil_length,2))]
Copy file name to clipboardExpand all lines: src/discretization/generate_finite_difference_rules.jl
+7-2Lines changed: 7 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,12 @@
4
4
Interpolate gridpoints by taking the average of the values of the discrete points, or if the offset is outside the grid, extrapolate the value with dx.
@@ -46,7 +51,7 @@ function cartesian_nonlinear_laplacian(expr, II, derivweights, s, x, u)
46
51
inner_interpolater = derivweights.interpmap[x]
47
52
48
53
# Get the outer weights and stencil. clip() essentially removes a point from either end of the grid, for this reason this function is only defined on the interior, not in bcs
0 commit comments