Skip to content

Commit f742d8c

Browse files
authored
Merge pull request #217 from xtalax/edgehotfix
fix integer dx with edge_align
2 parents 450fc88 + 951276d commit f742d8c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/discretization/discretize_vars.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ function DiscreteSpace(vars, discretization::MOLFiniteDifference{G}) where {G}
8888
t = vars.time
8989
depvars = vars.
9090
nspace = length(x̄)
91+
9192
# Discretize space
9293
axies = map(x̄) do x
9394
xdomain = vars.intervals[x]
@@ -221,15 +222,15 @@ map_symbolic_to_discrete(II::CartesianIndex, s::DiscreteSpace{N,M}) where {N,M}
221222

222223
# TODO: Allow other grids
223224

224-
@inline function generate_grid(x̄, axies, domain, discretization::MOLFiniteDifference{G}) where {G<:CenterAlignedGrid}
225+
@inline function generate_grid(x̄, axies, intervals, discretization::MOLFiniteDifference{G}) where {G<:CenterAlignedGrid}
225226
return axies
226227
end
227228

228229
@inline function generate_grid(x̄, axies, intervals, discretization::MOLFiniteDifference{G}) where {G<:EdgeAlignedGrid}
229230
dict = Dict(axies)
230231
return map(x̄) do x
231232
xdomain = intervals[x]
232-
dx = discretization.dxs[x]
233+
dx = prepare_dx(discretization.dxs[x], xdomain, discretization.grid_align)
233234
if dict[x] isa StepRangeLen
234235
x => (xdomain[1]-dx/2):dx:(xdomain[2]+dx/2)
235236
else

0 commit comments

Comments
 (0)