9696end
9797
9898# @test_set "Test 02: Dt(u(t,x)) ~ Dx(D(t,x))*Dx(u(t,x))+D(t,x)*Dxx(u(t,x))" begin
99- @test_skip begin
99+ @test_broken begin
100100 # Parameters, variables, and derivatives
101101 @parameters t x
102102 @variables u (.. ) D (.. )
136136 # Test
137137 n = size (sol,1 )
138138 t_f = size (sol,3 )
139- @test_skip sol[:,1 ,t_f] ≈ zeros (n) atol= 0.01 ;
139+ @test_broken sol[:,1 ,t_f] ≈ zeros (n) atol= 0.01 ;
140140end
141141
142142@testset " Test 03: Dt(u(t,x)) ~ Dxx(u(t,x)), Neumann BCs" begin
@@ -276,49 +276,51 @@ end
276276end
277277
278278
279- @test_skip begin
280- # @testset "Test 06: Dt(u(t,x)) ~ Dxx(u(t,x)), time-dependent Robin BCs" begin
281- # Method of Manufactured Solutions
282- u_exact = (x,t) -> exp .(- t) * sin .(x)
283-
284- # Parameters, variables, and derivatives
285- @parameters t x
286- @variables u (.. )
287- Dt = Differential (t)
288- Dx = Differential (x)
289- Dxx = Differential (x)^ 2
290-
291- # 1D PDE and boundary conditions
292- eq = Dt (u (t,x)) ~ Dxx (u (t,x))
293- bcs = [u (0 ,x) ~ sin (x),
294- t^ 2 * u (t,- 1.0 ) + 3 Dx (u (t,- 1.0 )) ~ exp (- t) * (t^ 2 * sin (- 1.0 ) + 3 cos (- 1.0 )),
295- 4 u (t,1.0 ) + t * Dx (u (t,1.0 )) ~ exp (- t) * (4 sin (1.0 ) + t * cos (1.0 ))]
296-
297- # Space and time domains
298- domains = [t ∈ IntervalDomain (0.0 ,1.0 ),
299- x ∈ IntervalDomain (- 1.0 ,1.0 )]
300-
301- # PDE system
302- pdesys = PDESystem (eq,bcs,domains,[t,x],[u (t,x)])
303-
304- # Method of lines discretization
305- dx = 0.01
306- order = 2
307- discretization = MOLFiniteDifference ([x=> dx],t)
308-
309- # Convert the PDE problem into an ODE problem
310- prob = discretize (pdesys,discretization)
311-
312- # Solve ODE problem
313- sol = solve (prob,Rodas5 (),saveat= 0.1 )
314-
315- x = (- 1 : dx: 1 )[2 : end - 1 ]
316- t = sol. t
317-
318- # Test against exact solution
319- for i in 1 : length (sol)
320- exact = u_exact (x, t[i])
321- u_approx = sol. u[i]
322- @test u_approx ≈ exact atol= 0.01
323- end
324- end
279+ @testset " Test 06: Dt(u(t,x)) ~ Dxx(u(t,x)), time-dependent Robin BCs" begin
280+ # Method of Manufactured Solutions
281+ u_exact = (x,t) -> exp .(- t) * sin .(x)
282+
283+ # Parameters, variables, and derivatives
284+ @parameters t x
285+ @variables u (.. )
286+ Dt = Differential (t)
287+ Dx = Differential (x)
288+ Dxx = Differential (x)^ 2
289+
290+ # 1D PDE and boundary conditions
291+ eq = Dt (u (t,x)) ~ Dxx (u (t,x))
292+ bcs = [u (0 ,x) ~ sin (x),
293+ t^ 2 * u (t,- 1.0 ) + 3 Dx (u (t,- 1.0 )) ~ exp (- t) * (t^ 2 * sin (- 1.0 ) + 3 cos (- 1.0 )),
294+ 4 u (t,1.0 ) + t * Dx (u (t,1.0 )) ~ exp (- t) * (4 sin (1.0 ) + t * cos (1.0 ))]
295+
296+ # Space and time domains
297+ domains = [t ∈ IntervalDomain (0.0 ,1.0 ),
298+ x ∈ IntervalDomain (- 1.0 ,1.0 )]
299+
300+ # PDE system
301+ pdesys = PDESystem (eq,bcs,domains,[t,x],[u (t,x)])
302+
303+ # Method of lines discretization
304+ dx = 0.01
305+ order = 2
306+ discretization = MOLFiniteDifference ([x=> dx],t)
307+
308+ # Convert the PDE problem into an ODE problem
309+ prob = discretize (pdesys,discretization)
310+
311+ # Solve ODE problem
312+ sol = solve (prob,Rodas4 (),reltol= 1e-6 ,saveat= 0.1 )
313+
314+ x = (- 1 : dx: 1 )
315+ t = sol. t
316+
317+ # Test against exact solution
318+ for i in 1 : length (sol)
319+ exact = u_exact (x, t[i])
320+ # Due to structural simplification
321+ # [u2 -> u(n-1), u(1), u(n)]
322+ # Will be fixed by sol[u]
323+ u_approx = [sol. u[i][end - 1 ];sol. u[i][1 : end - 2 ];sol. u[i][end ]]
324+ @test u_approx ≈ exact atol= 0.05
325+ end
326+ end
0 commit comments