@@ -70,9 +70,9 @@ function analytic_sol_func(t, x)
7070end
7171
7272u_predict = reshape([first(phi([t, x], res.u)) for t in ts for x in xs],
73- (length(ts), length(xs)))
73+ (length(ts), length(xs)))
7474u_real = reshape([analytic_sol_func(t, x) for t in ts for x in xs],
75- (length(ts), length(xs)))
75+ (length(ts), length(xs)))
7676
7777diff_u = abs.(u_predict .- u_real)
7878p1 = plot(ts, xs, u_real, linetype = :contourf, title = "analytic");
@@ -121,7 +121,7 @@ eq = Dx(Dxu(t, x)) ~ 1 / v^2 * Dt(Dtu(t, x)) + b * Dtu(t, x)
121121bcs_ = [u(t, 0) ~ 0.0,# for all t > 0
122122 u(t, L) ~ 0.0,# for all t > 0
123123 u(0, x) ~ x * (1.0 - x), # for all 0 < x < 1
124- Dtu(0, x) ~ 1 - 2x, # for all 0 < x < 1
124+ Dtu(0, x) ~ 1 - 2x # for all 0 < x < 1
125125]
126126
127127ep = (cbrt(eps(eltype(Float64))))^2 / 6
@@ -139,16 +139,16 @@ domains = [t ∈ Interval(0.0, L),
139139inn = 25
140140innd = 4
141141chain = [[Lux.Chain(Dense(2, inn, Lux.tanh),
142- Dense(inn, inn, Lux.tanh),
143- Dense(inn, inn, Lux.tanh),
144- Dense(inn, 1)) for _ in 1:3]
142+ Dense(inn, inn, Lux.tanh),
143+ Dense(inn, inn, Lux.tanh),
144+ Dense(inn, 1)) for _ in 1:3]
145145 [Lux.Chain(Dense(2, innd, Lux.tanh), Dense(innd, 1)) for _ in 1:2]]
146146
147147strategy = GridTraining(0.02)
148148discretization = PhysicsInformedNN(chain, strategy;)
149149
150150@named pde_system = PDESystem(eq, bcs, domains, [t, x],
151- [u(t, x), Dxu(t, x), Dtu(t, x), O1(t, x), O2(t, x)])
151+ [u(t, x), Dxu(t, x), Dtu(t, x), O1(t, x), O2(t, x)])
152152prob = discretize(pde_system, discretization)
153153sym_prob = NeuralPDE.symbolic_discretize(pde_system, discretization)
154154
@@ -201,10 +201,11 @@ gif(anim, "1Dwave_damped_adaptive.gif", fps = 200)
201201
202202# Surface plot
203203ts, xs = [infimum(d.domain):0.01:supremum(d.domain) for d in domains]
204- u_predict = reshape([first(phi([t, x], res.u.depvar.u)) for
205- t in ts for x in xs], (length(ts), length(xs)))
204+ u_predict = reshape(
205+ [first(phi([t, x], res.u.depvar.u)) for
206+ t in ts for x in xs], (length(ts), length(xs)))
206207u_real = reshape([analytic_sol_func(t, x) for t in ts for x in xs],
207- (length(ts), length(xs)))
208+ (length(ts), length(xs)))
208209
209210diff_u = abs.(u_predict .- u_real)
210211p1 = plot(ts, xs, u_real, linetype = :contourf, title = "analytic");
0 commit comments