@@ -37,7 +37,6 @@ analytic_sol_func(t, x) = -2*nu*(-(-8*t + 2*x)*exp(-(-4*t + x)^2/(4*nu*(t + 1)))
3737
3838```julia
3939function burgers(strategy, minimizer)
40-
4140 @parameters x t
4241 @variables u(..)
4342 Dt = Differential(t)
@@ -47,16 +46,16 @@ function burgers(strategy, minimizer)
4746 eq = Dt(u(x, t)) + u(x, t) * Dx(u(x, t)) ~ nu * Dxx(u(x, t))
4847
4948 bcs = [u(x, 0.0) ~ analytic_sol_func(x, 0.0),
50- u(0.0, t) ~ u(x_max, t)]
49+ u(0.0, t) ~ u(x_max, t)]
5150
5251 domains = [x ∈ Interval(0.0, x_max),
53- t ∈ Interval(0.0, t_max)]
52+ t ∈ Interval(0.0, t_max)]
5453
5554 chain = Lux.Chain(Lux.Dense(2, 16, tanh), Lux.Dense(16, 16, tanh), Lux.Dense(16, 1))
5655 discretization = PhysicsInformedNN(chain, strategy)
5756
58- indvars = [x, t] #physically independent variables
59- depvars = [u] #dependent (target) variable
57+ indvars = [x, t] # physically independent variables
58+ depvars = [u] # dependent (target) variable
6059
6160 dim = length(domains)
6261
@@ -77,28 +76,23 @@ function burgers(strategy, minimizer)
7776 end
7877
7978 cb = function (p, l)
80-
8179 timeCounter = 0.0
82- deltaT_s = time_ns() #Start a clock when the callback begins, this will evaluate questo misurerà anche il calcolo degli uniform error
80+ deltaT_s = time_ns() # Start a clock when the callback begins
8381
84- ctime = time_ns() - startTime - timeCounter #This variable is the time to use for the time benchmark plot
85- append!(times, ctime / 10^9) #Conversion nanosec to seconds
82+ ctime = time_ns() - startTime - timeCounter # Time for the time benchmark plot
83+ append!(times, ctime / 10^9) # Conversion nanosec to seconds
8684 append!(losses, l)
87- append!(error, loss_function__(p))
88- #println(length(losses), " Current loss is: ", l, " uniform error is, ", loss_function__(p))
85+ append!(error, l)
8986
90- timeCounter = timeCounter + time_ns() - deltaT_s #timeCounter sums all delays due to the callback functions of the previous iterations
87+ timeCounter = timeCounter + time_ns() - deltaT_s # Sum all delays due to the callback functions
9188
9289 return false
9390 end
9491
9592 @named pde_system = PDESystem(eq, bcs, domains, indvars, depvars)
93+ prob = discretize(pde_system, discretization)
9694
97- discretization = NeuralPDE.PhysicsInformedNN(chain, strategy)
98- prob = NeuralPDE.discretize(pde_system, discretization)
99-
100- startTime = time_ns() #Fix initial time (t=0) before starting the training
101-
95+ startTime = time_ns() # Fix initial time (t=0) before starting the training
10296
10397 if minimizer == "both"
10498 res = Optimization.solve(prob, ADAM(); callback=cb, maxiters=5)
0 commit comments