From fb04650b2453a4309eacb4cdd88d2a15a7f3d73f Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Thu, 16 May 2024 09:50:00 +1000 Subject: [PATCH 1/5] Updated compats --- Project.toml | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 1ad4f42..5d623e8 100755 --- a/Project.toml +++ b/Project.toml @@ -17,11 +17,29 @@ GridapSolvers = "6d3209ee-5e3c-4db7-a716-942eb12ed534" JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195" -MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267" PartitionedArrays = "5a9dfac6-5c52-46f7-8278-5e2210713be9" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[compat] +BenchmarkTools = "1" +BlockArrays = "0.16" +ChainRulesCore = "1" +CircularArrays = "1" +FillArrays = "0.8.4,1" +Gridap = "0.18" +GridapDistributed = "0.4" +GridapPETSc = "0.5" +GridapSolvers = "0.3" +JLD2 = "0.4" +MPI = "0.19, 0.20" +PartitionedArrays = "0.3" +SparseMatricesCSR = "0.6.6" +julia = "1.6.7" [extras] MPIPreferences = "3da0fdf6-3ccc-4f1b-acd9-58baa6c99267" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] From c368b9f10b6a9e2b8c1458837c8f546f9b259b83 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Thu, 16 May 2024 17:51:44 +1000 Subject: [PATCH 2/5] Deleted compilation files --- compile/compile.jl | 5 --- compile/warmup.jl | 97 ---------------------------------------------- 2 files changed, 102 deletions(-) delete mode 100644 compile/compile.jl delete mode 100644 compile/warmup.jl diff --git a/compile/compile.jl b/compile/compile.jl deleted file mode 100644 index f3fc72d..0000000 --- a/compile/compile.jl +++ /dev/null @@ -1,5 +0,0 @@ -using PackageCompiler - -create_sysimage([:GridapTopOpt], - sysimage_path=joinpath(@__DIR__,"..","GridapTopOpt.so"), - precompile_execution_file=joinpath(@__DIR__,"warmup.jl")) diff --git a/compile/warmup.jl b/compile/warmup.jl deleted file mode 100644 index feed08f..0000000 --- a/compile/warmup.jl +++ /dev/null @@ -1,97 +0,0 @@ -using Gridap, GridapDistributed, GridapPETSc, PartitionedArrays, GridapTopOpt - -""" - (MPI) Minimum thermal compliance with Lagrangian method in 2D. - - Optimisation problem: - Min J(Ω) = ∫ D*∇(u)⋅∇(u) + ξ dΩ - Ω - s.t., ⎡u∈V=H¹(Ω;u(Γ_D)=0), - ⎣∫ D*∇(u)⋅∇(v) dΩ = ∫ v dΓ_N, ∀v∈V. -""" -function main(mesh_partition,distribute) - ranks = distribute(LinearIndices((prod(mesh_partition),))) - - ## Parameters - order = 1; - xmax=ymax=1.0 - prop_Γ_N = 0.2; - prop_Γ_D = 0.2 - dom = (0,xmax,0,ymax); - el_size = (30,30); - γ = 0.1; - γ_reinit = 0.5; - max_steps = 1 - tol = 1/(order^2*10)/minimum(el_size) # <- change to 1/order^2*prod(...) ? - D = 1; - η_coeff = 2; - α_coeff = 4; - path = dirname(dirname(@__DIR__))*"/results/MPI_main" - - ## FE Setup - model = CartesianDiscreteModel(ranks,mesh_partition,dom,el_size); - Δ = get_el_size(model) - f_Γ_D(x) = (x[1] ≈ 0.0 && (x[2] <= ymax*prop_Γ_D + eps() || - x[2] >= ymax-ymax*prop_Γ_D - eps())) ? true : false; - f_Γ_N(x) = (x[1] ≈ xmax && ymax/2-ymax*prop_Γ_N/2 - eps() <= x[2] <= - ymax/2+ymax*prop_Γ_N/2 + eps()) ? true : false; - update_labels!(1,model,f_Γ_D,"Gamma_D") - update_labels!(2,model,f_Γ_N,"Gamma_N") - - ## Triangulations and measures - Ω = Triangulation(model) - Γ_N = BoundaryTriangulation(model,tags="Gamma_N") - dΩ = Measure(Ω,2order) - dΓ_N = Measure(Γ_N,2order) - - ## Spaces - reffe_scalar = ReferenceFE(lagrangian,Float64,order) - V = TestFESpace(model,reffe_scalar;dirichlet_tags=["Gamma_D"]) - U = TrialFESpace(V,0.0) - V_φ = TestFESpace(model,reffe_scalar) - V_reg = TestFESpace(model,reffe_scalar;dirichlet_tags=["Gamma_N"]) - U_reg = TrialFESpace(V_reg,0) - - ## Create FE functions - φh = interpolate(initial_lsf(4,0.2),V_φ); - φ = get_free_dof_values(φh) - - ## Interpolation and weak form - interp = SmoothErsatzMaterialInterpolation(η = η_coeff*maximum(Δ)) - I,H,DH,ρ = interp.I,interp.H,interp.DH,interp.ρ - - a(u,v,φ,dΩ,dΓ_N) = ∫((I ∘ φ)*D*∇(u)⋅∇(v))dΩ - l(v,φ,dΩ,dΓ_N) = ∫(v)dΓ_N - res(u,v,φ,dΩ,dΓ_N) = a(u,v,φ,dΩ,dΓ_N) - l(v,φ,dΩ,dΓ_N) - - ## Optimisation functionals - ξ = 0.3; - J = (u,φ,dΩ,dΓ_N) -> ∫((I ∘ φ)*D*∇(u)⋅∇(u) + ξ*(ρ ∘ φ))dΩ - dJ = (q,u,φ,dΩ,dΓ_N) -> ∫((ξ-D*∇(u)⋅∇(u))*q*(DH ∘ φ)*(norm ∘ ∇(φ)))dΩ; - - ## Finite difference solver and level set function - ls_evo = HamiltonJacobiEvolution(FirstOrderStencil(2,Float64),model,V_φ,Δ./order,max_steps,tol) - reinit!(stencil,φ,γ_reinit) - - ## Setup solver and FE operators - state_map = AffineFEStateMap(a,l,res,U,V,V_φ,U_reg,φh,dΩ,dΓ_N) - pcfs = PDEConstrainedFunctionals(J,state_map,analytic_dJ=dJ) - - ## Hilbertian extension-regularisation problems - α = α_coeff*maximum(Δ) - a_hilb(p,q) =∫(α^2*∇(p)⋅∇(q) + p*q)dΩ; - vel_ext = VelocityExtension(a_hilb,U_reg,V_reg) - - ## Optimiser - _conv_cond = t->GridapTopOpt.conv_cond(t;coef=1/50); - optimiser = AugmentedLagrangian(φ,pcfs,ls_evo,vel_ext,interp,el_size,γ,γ_reinit,conv_criterion=_conv_cond); - for history in optimiser - it,Ji,_,_ = last(history) - print_history(it,["J"=>Ji];ranks=ranks) - break - end -end - -with_mpi() do distribute - main((1,1),distribute) -end; From 9fe05bbfb3454b87491311f76a79f31cd448e2fe Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Thu, 16 May 2024 17:52:01 +1000 Subject: [PATCH 3/5] Unpinned GridapSolvers develop branch --- .github/workflows/ci.yml | 2 -- .github/workflows/ci_mpi.yml | 1 - README.md | 3 --- 3 files changed, 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f439cdc..7385b1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: with: version: ${{ matrix.version }} arch: ${{ matrix.arch }} - - run: julia --project=. -e 'using Pkg; Pkg.add(name="GridapSolvers", rev="develop");' - uses: actions/cache@v1 env: cache-name: cache-artifacts @@ -51,7 +50,6 @@ jobs: using Pkg Pkg.develop(PackageSpec(path=pwd())) Pkg.instantiate() - Pkg.add(name="GridapSolvers", rev="develop")' - run: julia --project=docs docs/make.jl env: DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/ci_mpi.yml b/.github/workflows/ci_mpi.yml index f21a57c..e3ffb7c 100644 --- a/.github/workflows/ci_mpi.yml +++ b/.github/workflows/ci_mpi.yml @@ -61,7 +61,6 @@ jobs: - uses: julia-actions/julia-buildpkg@latest - run: echo $PWD - run: julia --project=. -e 'using Pkg; Pkg.instantiate();' - - run: julia --project=. -e 'using Pkg; Pkg.add(name="GridapSolvers", rev="develop");' - run: julia --project=. -e 'using Pkg; Pkg.add("MPIPreferences")' - run: julia --project=. -e 'using MPIPreferences; MPIPreferences.use_system_binary()' - run: julia --project=. -e 'using Pkg; Pkg.build(); Pkg.precompile()' diff --git a/README.md b/README.md index b1c52c2..fbd8b58 100755 --- a/README.md +++ b/README.md @@ -12,6 +12,3 @@ GridapTopOpt is computational toolbox for level set-based topology optimisation ## Citation In order to give credit to the `GridapTopOpt` contributors, we ask that you please reference the above paper along with the required citations for [Gridap](https://github.com/gridap/Gridap.jl?tab=readme-ov-file#how-to-cite-gridap). - -## Known issues -- We currently require the `develop` branch of `GridapSolvers` for `GridapTopOpt`. Ensure that this is correctly loaded via `pkg> add GridapSolvers#develop`. From 9b2cfa844f6dc7f385246799de81fa5842629e3d Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Thu, 16 May 2024 17:54:37 +1000 Subject: [PATCH 4/5] Minor --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index fbd8b58..4fc6eca 100755 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # GridapTopOpt + [![](https://img.shields.io/badge/docs-stable-blue.svg)](https://zjwegert.github.io/GridapTopOpt.jl/stable) [![Build Status](https://github.com/zjwegert/GridapTopOpt.jl/workflows/CI/badge.svg?branch=main)](https://github.com/zjwegert/GridapTopOpt.jl/actions?query=workflow%3ACI) [![Codecov](https://codecov.io/gh/zjwegert/GridapTopOpt.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/zjwegert/GridapTopOpt.jl) GridapTopOpt is computational toolbox for level set-based topology optimisation implemented in Julia and the [Gridap](https://github.com/gridap/Gridap.jl) package ecosystem. See the documentation and following publication for further details: @@ -11,4 +12,5 @@ GridapTopOpt is computational toolbox for level set-based topology optimisation - [**DEVELOP**](https://zjwegert.github.io/GridapTopOpt.jl/dev) — *Documentation for the most recent in-development version.* ## Citation + In order to give credit to the `GridapTopOpt` contributors, we ask that you please reference the above paper along with the required citations for [Gridap](https://github.com/gridap/Gridap.jl?tab=readme-ov-file#how-to-cite-gridap). From 939d8dcc4c45ed7c28510b097ce30e0a48c082b8 Mon Sep 17 00:00:00 2001 From: JordiManyer Date: Thu, 16 May 2024 18:02:13 +1000 Subject: [PATCH 5/5] Minor --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7385b1e..8ede235 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: julia --project=docs -e ' using Pkg Pkg.develop(PackageSpec(path=pwd())) - Pkg.instantiate() + Pkg.instantiate()' - run: julia --project=docs docs/make.jl env: DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}