Skip to content

confusing locations of spatial points with periodic conditions #109

@YichengDWu

Description

@YichengDWu

The derived ODE problem below contains 5 spatial points, from the first inner point to the right boundary. I believe it's a natural result of structural simplification. But the users need to be notified the points are located from the first inner point to the right boundary, not the other way around

using ModelingToolkit, MethodOfLines, DomainSets
using OrdinaryDiffEq

@parameters t x
@variables u(..) 

Dt = Differential(t)
Dx = Differential(x)

eq = Dt(u(t, x)) ~  -2.0  * Dx(u(t, x))

tmin,tmax = 0, 4
xmin,xmax = 0, 1

domains = [x  Interval(xmin, xmax),
           t  Interval(tmin, tmax)]

bcs = [u(0,x) ~ sin(2π*x),
       u(t,xmin)~u(t,xmax)]
       
@named pdesys = PDESystem(eq,bcs,domains,[t,x],[u(t,x)])

discretization = MOLFiniteDifference([x=>0.2], t, approx_order=2, grid_align=center_align)
prob = discretize(pdesys,discretization)

@show prob.u0

grid = get_discrete(pdesys,discretization)
grid[u(t,x)]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions