From 8b2d0a1f4f96963b24433321245fbae3760f9a14 Mon Sep 17 00:00:00 2001 From: xtalax Date: Sat, 1 Apr 2023 17:22:11 +0100 Subject: [PATCH 1/5] test neuralpde --- Project.toml | 2 +- test/neuralpde_test.jl | 4 ++-- test/runtests.jl | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 6e4aa22..3c81126 100644 --- a/Project.toml +++ b/Project.toml @@ -32,4 +32,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "MethodOfLines", "Lux", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] +test = ["Test", "MethodOfLines", "Lux", "NeuralPDE", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] diff --git a/test/neuralpde_test.jl b/test/neuralpde_test.jl index ffdb643..7b3a95f 100644 --- a/test/neuralpde_test.jl +++ b/test/neuralpde_test.jl @@ -4,7 +4,7 @@ PSL = PDESystemLibrary using NeuralPDE, Lux, OptimizationOptimJL for ex in PSL.all_systems - @testset "Example with NeuralPDE.jl: $(ex.name)\n Equations: $(ex.eqs) \nBCs/ICs: $(ex.bcs)" begin + @testset "Example with NeuralPDE.jl: $(ex.name)" begin dim = length(ex.ivs) # number of dimensions N = 8 * dim chain = Lux.Chain(Dense(dim, N, Lux.σ), Dense(N, N, Lux.σ), Dense(N, 1)) @@ -25,7 +25,7 @@ for ex in PSL.all_systems return false end - res = Optimization.solve(prob, opt, callback = callback, maxiters = 1000) + res = Optimization.solve(prob, opt, callback = callback, maxiters = 400) phi = discretization.phi end end diff --git a/test/runtests.jl b/test/runtests.jl index 2fa4b48..3389c19 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -11,6 +11,6 @@ end # TODO: fix this when NeuralPDE.jl can be added to the test environment. (compat with Symbolics.jl 5) -# if GROUP == "All" || GROUP == "NeuralPDE" -# @time @safetestset "Test against NeuralPDE.jl" begin include("neuralpde_test.jl") end -# end +if GROUP == "All" || GROUP == "NeuralPDE" + @time @safetestset "Test against NeuralPDE.jl" begin include("neuralpde_test.jl") end +end From a10aa22b61fc62e3253ea9694ff3f76cd860fa1f Mon Sep 17 00:00:00 2001 From: xtalax Date: Sat, 1 Apr 2023 18:45:47 +0100 Subject: [PATCH 2/5] add neural to deps --- Project.toml | 5 +++-- src/PDESystemLibrary.jl | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 3c81126..c1198f0 100644 --- a/Project.toml +++ b/Project.toml @@ -9,7 +9,6 @@ IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" -OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" @@ -24,12 +23,14 @@ SciMLBase = "1.88" julia = "1.6" [extras] +NeuralPDE = "315f7962-48a3-4962-8226-d0f33b1235f0" Lux = "b2108857-7c20-44ae-9111-449ecde12c47" MethodOfLines = "94925ecb-adb7-4558-8ed8-f975c56a0bf4" NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "MethodOfLines", "Lux", "NeuralPDE", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] +test = ["Test", "MethodOfLines", "Lux", "OrdinaryDiffEq", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] diff --git a/src/PDESystemLibrary.jl b/src/PDESystemLibrary.jl index a0b49ce..4109615 100644 --- a/src/PDESystemLibrary.jl +++ b/src/PDESystemLibrary.jl @@ -1,6 +1,5 @@ module PDESystemLibrary using ModelingToolkit, DomainSets -using OrdinaryDiffEq using Interpolations import SciMLBase From 479bff31c0d1219d4223ee125dcf792ed93ec004 Mon Sep 17 00:00:00 2001 From: xtalax Date: Sat, 1 Apr 2023 18:48:38 +0100 Subject: [PATCH 3/5] update project --- Project.toml | 4 ++-- src/PDESystemLibrary.jl | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index c1198f0..4e89b10 100644 --- a/Project.toml +++ b/Project.toml @@ -9,6 +9,7 @@ IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" @@ -28,9 +29,8 @@ Lux = "b2108857-7c20-44ae-9111-449ecde12c47" MethodOfLines = "94925ecb-adb7-4558-8ed8-f975c56a0bf4" NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec" OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e" -OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "MethodOfLines", "Lux", "OrdinaryDiffEq", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] +test = ["Test", "MethodOfLines", "Lux", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] diff --git a/src/PDESystemLibrary.jl b/src/PDESystemLibrary.jl index 4109615..a0b49ce 100644 --- a/src/PDESystemLibrary.jl +++ b/src/PDESystemLibrary.jl @@ -1,5 +1,6 @@ module PDESystemLibrary using ModelingToolkit, DomainSets +using OrdinaryDiffEq using Interpolations import SciMLBase From 754ea3134541a815d1e3c13c2e994d5050277319 Mon Sep 17 00:00:00 2001 From: xtalax Date: Sat, 1 Apr 2023 18:49:28 +0100 Subject: [PATCH 4/5] update project --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 4e89b10..2307490 100644 --- a/Project.toml +++ b/Project.toml @@ -33,4 +33,4 @@ SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["Test", "MethodOfLines", "Lux", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] +test = ["Test", "MethodOfLines", "NeuralPDE", "Lux", "NonlinearSolve", "OptimizationOptimJL", "SafeTestsets"] From 0ca3857dc38865fbb44734e98897369d0d7964c6 Mon Sep 17 00:00:00 2001 From: xtalax Date: Sun, 2 Apr 2023 00:02:10 +0100 Subject: [PATCH 5/5] fix --- test/neuralpde_test.jl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/neuralpde_test.jl b/test/neuralpde_test.jl index 7b3a95f..f9ee679 100644 --- a/test/neuralpde_test.jl +++ b/test/neuralpde_test.jl @@ -13,8 +13,7 @@ for ex in PSL.all_systems dx = 0.05 discretization = PhysicsInformedNN(chain, GridTraining(dx)) - @named pde_system = PDESystem(eq, bcs, domains, [x, y], [u(x, y)]) - prob = discretize(pde_system, discretization) + prob = discretize(ex, discretization) #Optimizer opt = OptimizationOptimJL.BFGS()