I’m working with ModellingToolkit and DiffEqOperators to solve a set of PDEs, and I wanted to test out a simpler problem before I jumped into a more complicated problem. I followed the heat equation example and that worked, so I next wanted to try 1D linear advection with periodic boundary conditions, but I’m having some issues with the boundary conditions:
@parameters t x
@variables u(..)
@derivatives Dt'~t
@derivatives Dx'~x
a = 1
advection_eq = Dt(u(t, x)) ~ -a * Dx(u(t, x))
advection_bcs = [
u(0, x) ~ sinpi(x),
PeriodicBC(Float64)
]
domains = [
t ∈ IntervalDomain(0.0, 1.0),
x ∈ IntervalDomain(0.0, 1.0)
]
advection_pdesys = PDESystem(advection_eq, advection_bcs, domains, [t, x], [u])
advection_dx = 0.01
advection_order = 2
advection_discretization = MOLFiniteDifference(advection_dx, advection_order)
advection_prob = ModelingToolkit.discretize(advection_pdesys, advection_discretization)
advection_sol = solve(advection_prob, Tsit5(), saveat = 0.1)
This errors because type PeriodicBC has no field lhs
, so I’m definitely using this incorrectly, so I was wondering what the intended way to use the periodic boundary condition was (and for that matter, other non-dirichlet boundary conditions)
I’ve also tried u(t, 0) ~ u(t, 1)
but that gives me either an undefined reference error or UndefVarError: u not defined
It doesn’t support PeriodicBC at this time. I plan to merge Robin BC support this week though.
Oh cool, thanks for that!
Hi Chris. I’m also learning ModelingToolkit.jl by trying to solve the Burgers 1D equation using periodic boundary conditions. I’m trying doing:
u(t,0) ~ u(t,2*π)
But, although I don’t get any error when solving using NeuralPDE, the results don’t seem right.
I’m wondering if this is implemented. If not, could you please point me in the direction I should start looking to understand how bcs are implemented. Maybe I could work on writing and, hopefully, contribute this to the project. Right know I’m a little lost within the sciml ecosystem and don’t even know where to start looking.
Can you open an issue on NeuralPDE.jl with your example? I’ll need to look at plots of the loss function to check the convergence. This is with QuadratureStrategy right?
Yeah the PDESystem stuff isn’t quite documented yet because it’s not quite “production-ready”, so it’s really just at the stage for those willing to dive a bit into the development. Give it a year for that.
Thanks for the quick response. I will open the issue.
I’m using GridTraining as is a 1d example. Should I try QuadratureStrategy?
Although I have some experience with python, I’m quite new to Julia. Nevertheless I’m really interested, and willing, to dive and contribute with the development. I’m a professor at a university in Colombia and have some students also very interested in learning and, hopefully, contributing.
Yeah, I think GridTraining is a generally bad idea. We are building more and more evidence of that.