Hello. I’m trying to replicate this example in the NeuralPDE.jl documentation, but with a different PDE. I’m getting an error when I define the optimizer for the PINN. Here is my code:
using NeuralPDE, Lux, ModelingToolkit, Optimization, OptimizationOptimJL
using ModelingToolkit: Interval
using Plots
@parameters x y
@variables u(..)
Dx = Differential(x)
Dy = Differential(y)
# Velocity (speed) field
V(x, y) = 1 + 0.1x + 0.1y
# Define PDE
eq = Dx(u(x, y))^2 + Dy(u(x, y))^2 ~ V(x, y)^-2
# Boundary condition for source point
bcs = [u(2.5, 2.5) ~ 0.0]
# Spatial domains
domains = [x ∈ Interval(0.0, 5.0), y ∈ Interval(0.0, 5.0)]
# Neural network
dim = 2 # number of dimensions
chain = Lux.Chain(Dense(dim, 16, Lux.σ), Dense(16, 16, Lux.σ), Dense(16, 1))
# Build PhysicsInformedNN algorithm
discretization = PhysicsInformedNN(chain, QuadratureTraining(; batch = 200, abstol = 1e-6, reltol = 1e-6))
# Define the PDESystem and create PINNs
@named pde_system = PDESystem(eq, bcs, domains, [x, y], [u(x, y)])
prob = discretize(pde_system, discretization)
# Define the optimizer and callback function
opt = OptimizationOptimJL.LBFGS(linesearch = BackTracking())
callback = function (p, l)
println("Current loss is: $l")
return false
end
This is producing the following error and stacktrace:
ERROR: UndefVarError: `BackTracking` not defined
Stacktrace:
[1] top-level scope
@ c:\Users\user\SciML\test.jl:34
#5 (generic function with 1 method)
Has the correct syntax changed since this tutorial was written?