We tried to do everything on a blank TOML (] activate .), if we try to install GalacticOptim on the default environment we receive a version error during installation.
The status of the default environment is the following:
[c52e3926] Atom v0.12.23
[fbb218c0] BSON v0.2.6
[6e4b80f9] BenchmarkTools v0.5.0
[8f4d0f93] Conda v1.4.1
[aae7a2af] DiffEqFlux v1.17.0
[41bf760c] DiffEqSensitivity v6.32.0
[0c46a032] DifferentialEquations v6.15.0
[587475ba] Flux v0.10.4
[e5e0dc1b] Juno v0.8.4
[961ee093] ModelingToolkit v3.21.0
[315f7962] NeuralPDE v2.0.0
[429524aa] Optim v0.20.1
[1dea7af3] OrdinaryDiffEq v5.42.3
[91a5bcdd] Plots v1.6.7
[438e738f] PyCall v1.92.0
[d330b81b] PyPlot v2.9.0
[d2ef9438] Seaborn v0.4.1
[1d978283] TensorFlow v0.11.0
[e88e6eb3] Zygote v0.4.22
[8bb1440f] DelimitedFiles
The example we are trying to run is the following:
using NeuralPDE, Flux, ModelingToolkit, GalacticOptim, Optim, DiffEqFlux
#GalacticOptim
# 3D PDE
@parameters x y t θ
@variables u(..)
@derivatives Dxx''~x
@derivatives Dyy''~y
@derivatives Dt'~t
# 3D PDE
eq = Dt(u(x,y,t,θ)) ~ Dxx(u(x,y,t,θ)) + Dyy(u(x,y,t,θ))
# Initial and boundary conditions
bcs = [u(x,y,0,θ) ~ exp(x+y)*cos(x+y),
u(0,y,t,θ) ~ exp(y)*cos(y+4t),
u(2,y,t,θ) ~ exp(2+y)*cos(2+y+4t) ,
u(x,0,t,θ) ~ exp(x)*cos(x+4t),
u(x,2,t,θ) ~ exp(x+2)*cos(x+2+4t)]
# Space and time domains
domains = [x ∈ IntervalDomain(0.0,2.0),
y ∈ IntervalDomain(0.0,2.0),
t ∈ IntervalDomain(0.0,2.0)]
# Discretization
dx = 0.25; dy= 0.25; dt = 0.25
# Neural network
chain = FastChain(FastDense(3,16,Flux.σ),FastDense(16,16,Flux.σ),FastDense(16,1))
discretization = NeuralPDE.PhysicsInformedNN([dx,dy,dt],
chain,
strategy = NeuralPDE.StochasticTraining(include_frac=0.9))
pde_system = PDESystem(eq,bcs,domains,[x,y,t],[u])
prob = NeuralPDE.discretize(pde_system,discretization)
res = GalacticOptim.solve(prob, ADAM(0.1), progress = false; cb = cb, maxiters=3000)
phi = discretization.phi
ts,xs = [domain.domain.lower:dx:domain.domain.upper for domain in domains]
analytic_sol_func(t,x) = [exp(-t)*sin(pi*x), exp(-t)*cos(pi*x), (1+pi^2)*exp(-t)]
u_real = [[analytic_sol_func(t,x)[i] for t in ts for x in xs] for i in 1:3]
u_predict = [[phi([t,x],res.minimizer)[i] for t in ts for x in xs] for i in 1:3]
diff_u = [abs.(u_real[i] .- u_predict[i] ) for i in 1:3]
for i in 1:3
p1 = plot(xs, ts, u_real[i], st=:surface,title = "u$i, analytic");
p2 = plot(xs, ts, u_predict[i], st=:surface,title = "predict");
p3 = plot(xs, ts, diff_u[i],linetype=:contourf,title = "error");
plot(p1,p2,p3)
savefig("sol_u$i")
end