@@ -23,17 +23,23 @@ ic_f(x) = x < 0 ? 1.0 : 1 / 2
2323Dt = Differential (t)
2424Dx = Differential (x)
2525Dxx = Differential (x)^ 2
26- eqs = [Dt (u (t, x)) ~
27- Dx (
28- (inv (θ₁ * u (t, x)) + θ₂ * inv (u (t, x)^ 2 ) + θ₃ * inv (u (t, x)^ 3 )) *
29- Dx (u (t, x))
30- ) +
31- β * K * u (t, x) * (1 - u (t, x) / K)]
32- bcs = [Dx (u (t, 2 π)) ~ 0.0 ,
26+ eqs = [
27+ Dt (u (t, x)) ~
28+ Dx (
29+ (inv (θ₁ * u (t, x)) + θ₂ * inv (u (t, x)^ 2 ) + θ₃ * inv (u (t, x)^ 3 )) *
30+ Dx (u (t, x))
31+ ) +
32+ β * K * u (t, x) * (1 - u (t, x) / K),
33+ ]
34+ bcs = [
35+ Dx (u (t, 2 π)) ~ 0.0 ,
3336 Dx (u (t, - 2 π)) ~ 0.0 ,
34- u (0 , x) ~ ic_f (x)]
35- domains = [t ∈ Interval (0.0 , 1.0 ),
36- x ∈ Interval (- 2 π, 2 π)]
37+ u (0 , x) ~ ic_f (x),
38+ ]
39+ domains = [
40+ t ∈ Interval (0.0 , 1.0 ),
41+ x ∈ Interval (- 2 π, 2 π),
42+ ]
3743@named pdesys = PDESystem (
3844 eqs,
3945 bcs,
@@ -44,8 +50,8 @@ domains = [t ∈ Interval(0.0, 1.0),
4450 θ₁ => 1.0 ,
4551 θ₂ => 50.0 ,
4652 θ₃ => 3.0 ,
47- β => 1e -3 ,
48- K => 2.0
53+ β => 1.0e -3 ,
54+ K => 2.0 ,
4955 ]
5056)
5157discretisation = MOLFiniteDifference ([x => 0.1 ], t)
@@ -59,7 +65,7 @@ solu = sol[u(t, x)]
5965diffusion_function = (u, x, t, p) -> inv (p[1 ] * u) + p[2 ] * inv (u^ 2 ) + p[3 ] * inv (u^ 3 )
6066reaction_function = (u, x, t, p) -> p[1 ] * p[2 ] * u * (1 - u / p[2 ])
6167diffusion_parameters = [1.0 , 50.0 , 3.0 ]
62- reaction_parameters = [1e -3 , 2.0 ]
68+ reaction_parameters = [1.0e -3 , 2.0 ]
6369mesh_points = solx
6470initial_condition = ic_f .(mesh_points)
6571final_time = 1.0
@@ -78,7 +84,7 @@ fvm_prob = FVMProblem(
7884)
7985fvm_sol = solve (fvm_prob, TRBDF2 (), saveat = solt)
8086fvm_solu = reduce (hcat, fvm_sol. u)'
81- @test solu ≈ fvm_solu rtol = 1e -2
87+ @test solu ≈ fvm_solu rtol = 1.0e -2
8288
8389let sol = fvm_sol, t_range = LinRange (0.0 , final_time, 250 )
8490 fig = Figure (fontsize = 33 )
0 commit comments