Skip to content

Commit

Permalink
Rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwegert committed May 7, 2024
1 parent 6e1bcc1 commit ed2c639
Show file tree
Hide file tree
Showing 51 changed files with 298 additions and 298 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ docs/site/
# environment.
Manifest.toml
LocalPreferences.toml
LevelSetTopOpt.so
GridapTopOpt.so
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "LevelSetTopOpt"
name = "GridapTopOpt"
uuid = "27dd0110-1916-4fd6-8b4b-1bc109db1170"
authors = ["Zach Wegert <[email protected]>", "JordiManyer <[email protected]>"]
version = "0.1.0"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# LevelSetTopOpt
# GridapTopOpt

| **badges** |

LevelSetTopOpt 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:
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:

> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "LevelSetTopOpt.jl: A scalable Julia toolbox for level set-based topology optimisation". In preparation.
> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "GridapTopOpt.jl: A scalable Julia toolbox for level set-based topology optimisation". In preparation.
## Documentation

- [**STABLE**](...) &mdash; **Documentation for the most recently tagged version.**
- [**LATEST**](...) &mdash; *Documentation for the in-development version.*

## Citation
In order to give credit to the `LevelSetTopOpt` 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).
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).
4 changes: 2 additions & 2 deletions compile/compile.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using PackageCompiler

create_sysimage([:LevelSetTopOpt],
sysimage_path=joinpath(@__DIR__,"..","LevelSetTopOpt.so"),
create_sysimage([:GridapTopOpt],
sysimage_path=joinpath(@__DIR__,"..","GridapTopOpt.so"),
precompile_execution_file=joinpath(@__DIR__,"warmup.jl"))
4 changes: 2 additions & 2 deletions compile/warmup.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Gridap, GridapDistributed, GridapPETSc, PartitionedArrays, LevelSetTopOpt
using Gridap, GridapDistributed, GridapPETSc, PartitionedArrays, GridapTopOpt

"""
(MPI) Minimum thermal compliance with Lagrangian method in 2D.
Expand Down Expand Up @@ -83,7 +83,7 @@ function main(mesh_partition,distribute)
vel_ext = VelocityExtension(a_hilb,U_reg,V_reg)

## Optimiser
_conv_cond = t->LevelSetTopOpt.conv_cond(t;coef=1/50);
_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)
Expand Down
6 changes: 3 additions & 3 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
# using Pkg; Pkg.activate(".")

using Documenter
using LevelSetTopOpt
using GridapTopOpt

makedocs(
sitename = "LevelSetTopOpt.jl",
sitename = "GridapTopOpt.jl",
format = Documenter.HTML(
prettyurls = false,
# collapselevel = 1,
),
modules = [LevelSetTopOpt],
modules = [GridapTopOpt],
pages = [
"Home" => "index.md",
"Getting Started" => "getting-started.md",
Expand Down
12 changes: 6 additions & 6 deletions docs/src/dev/shape_der.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The final result of course does not yet match ``(\star)``. Over a fixed computat
J_1^\prime(\Omega)(-v\boldsymbol{n})=-\int_{D}vf(\boldsymbol{x})H'(\varphi)\lvert\nabla\varphi\rvert~\mathrm{d}s.
```

As ``\varphi`` is a signed distance function we have ``\lvert\nabla\varphi\rvert=1`` for ``D\setminus\Sigma`` where ``\Sigma`` is the skeleton of ``\Omega`` and ``\Omega^\complement``. Furthermore, ``H'(\varphi)`` provides support only within a band of ``\partial\Omega``.
As ``\varphi`` is a signed distance function we have ``\lvert\nabla\varphi\rvert=1`` for ``D\setminus\Sigma`` where ``\Sigma`` is the skeleton of ``\Omega`` and ``\Omega^\complement``. Furthermore, ``H'(\varphi)`` provides support only within a band of ``\partial\Omega``.

!!! tip "Result I"
Therefore, we have that almost everywhere
Expand Down Expand Up @@ -71,9 +71,9 @@ Consider ``\Omega\subset D`` with ``J(\Omega)=\int_\Omega j(\boldsymbol{u})~\mat
In the above ``\boldsymbol{\varepsilon}`` is the strain tensor, ``\boldsymbol{C}`` is the stiffness tensor, ``\Gamma_0 = \partial\Omega\setminus(\Gamma_D\cup\Gamma_N\cup\Gamma_R)``, and ``\Gamma_D``, ``\Gamma_N``, ``\Gamma_R`` are required to be fixed.

### Shape derivative
Let us first consider the shape derivative of ``J``. Disregarding embedding inside the computational domain ``D``, the above strong form can be written in weak form as:
Let us first consider the shape derivative of ``J``. Disregarding embedding inside the computational domain ``D``, the above strong form can be written in weak form as:

``\quad`` *Find* ``\boldsymbol{u}\in H^1_{\Gamma_D}(\Omega)^d`` *such that*
``\quad`` *Find* ``\boldsymbol{u}\in H^1_{\Gamma_D}(\Omega)^d`` *such that*

```math
\int_{\Omega} \boldsymbol{C\varepsilon}(\boldsymbol{u})\boldsymbol{\varepsilon}(\boldsymbol{v})~\mathrm{d}\boldsymbol{x}+\int_{\Gamma_R}\boldsymbol{w}(\boldsymbol{u})\cdot\boldsymbol{v}~\mathrm{d}s=\int_\Omega \boldsymbol{f}\cdot\boldsymbol{v}~\mathrm{d}\boldsymbol{x}+\int_{\Gamma_N}\boldsymbol{g}\cdot\boldsymbol{v}~\mathrm{d}s,~\forall \boldsymbol{v}\in H^1_{\Gamma_D}(\Omega)^d.
Expand Down Expand Up @@ -137,7 +137,7 @@ As required. Note that in the above, we have used that ``\boldsymbol{\theta}\cdo


### Gâteaux derivative in ``\varphi``
Let us now return to derivatives of ``J`` with respect to ``\varphi`` over the whole computational domain. As previously, suppose that we rewrite ``J`` as
Let us now return to derivatives of ``J`` with respect to ``\varphi`` over the whole computational domain. As previously, suppose that we rewrite ``J`` as

```math
\hat{\mathcal{J}}(\varphi)=\int_D (1-H(\varphi))j(\boldsymbol{u})~\mathrm{d}\boldsymbol{x}+\int_{\Gamma_N} l_1(\boldsymbol{u})~\mathrm{d}s+\int_{\Gamma_R} l_2(\boldsymbol{u})~\mathrm{d}s
Expand Down Expand Up @@ -212,7 +212,7 @@ This exactly as previously up to relaxation over ``D``. Finally, The derivative
\end{aligned}
```

where we have used that ``v=0`` on ``\Gamma_D`` as previously. As previously taking ``\boldsymbol{\theta}=v\boldsymbol{n}`` and relaxing the shape derivative of ``J`` over ``D`` with a signed distance function ``\varphi`` yields:
where we have used that ``v=0`` on ``\Gamma_D`` as previously. As previously taking ``\boldsymbol{\theta}=v\boldsymbol{n}`` and relaxing the shape derivative of ``J`` over ``D`` with a signed distance function ``\varphi`` yields:

!!! tip "Result II"
```math
Expand All @@ -227,7 +227,7 @@ Owing to a fixed computational regime we do not capture a variation of the domai
In addition, functionals of the signed distance function posed over the whole bounding domain ``D`` admit a special structure under shape differentiation ([Paper](https://doi.org/10.1051/m2an/2019056)). Such cases are not captured by a Gâteaux derivative at ``\varphi`` under relaxation.

!!! note
In future, we plan to implement CellFEM via GridapEmbedded in LevelSetTopOpt. This will enable Gâteaux derivative of the mapping
In future, we plan to implement CellFEM via GridapEmbedded in GridapTopOpt. This will enable Gâteaux derivative of the mapping

```math
\varphi \mapsto \int_{\Omega(\varphi)}f(\varphi)~\mathrm{d}\boldsymbol{x} + \int_{\Omega(\varphi)^\complement}f(\varphi)~\mathrm{d}\boldsymbol{x}.
Expand Down
18 changes: 9 additions & 9 deletions docs/src/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

## Installation

`LevelSetTopOpt.jl` and additional dependencies can be installed in an existing Julia environment using the package manager. This can be accessed in the Julia REPL (read-eval–print loop) by pressing `]`. We then add the required packages via:
`GridapTopOpt.jl` and additional dependencies can be installed in an existing Julia environment using the package manager. This can be accessed in the Julia REPL (read-eval–print loop) by pressing `]`. We then add the required packages via:
```
pkg> add LevelSetTopOpt, Gridap, GridapDistributed, GridapPETSc, GridapSolvers, PartitionedArrays, SparseMatricesCSR
pkg> add GridapTopOpt, Gridap, GridapDistributed, GridapPETSc, GridapSolvers, PartitionedArrays, SparseMatricesCSR
```
Once installed, serial driver scripts can be run immediately, whereas parallel problems also require an MPI installation.
Once installed, serial driver scripts can be run immediately, whereas parallel problems also require an MPI installation.

### MPI
For basic users, [`MPI.jl`](https://github.com/JuliaParallel/MPI.jl) provides such an implementation and a Julia wrapper for `mpiexec` - the MPI executor. This is installed via:
Expand All @@ -19,24 +19,24 @@ Once the `mpiexecjl` wrapper has been added to the system `PATH`, MPI scripts ca
```
mpiexecjl -n P julia main.jl
```
where `main` is a driver script, `P` denotes the number of processors.
where `main` is a driver script, `P` denotes the number of processors.

### PETSc
In `LevelSetTopOpt.jl` we rely on the [`GridapPETSc.jl`](https://github.com/gridap/GridapPETSc.jl) satellite package to interface with the linear and nonlinear solvers provided by the PETSc (Portable, Extensible Toolkit for Scientific Computation) library. For basic users these solvers are provided by `GridapPETSc.jl` with no additional work.
In `GridapTopOpt.jl` we rely on the [`GridapPETSc.jl`](https://github.com/gridap/GridapPETSc.jl) satellite package to interface with the linear and nonlinear solvers provided by the PETSc (Portable, Extensible Toolkit for Scientific Computation) library. For basic users these solvers are provided by `GridapPETSc.jl` with no additional work.

### Advanced installation
For more advanced installations, such as use of a custom MPI/PETSc installation on a HPC cluster, we refer the reader to the [discussion](https://github.com/gridap/GridapPETSc.jl) for `GridapPETSc.jl` and the [configuration page](https://juliaparallel.org/MPI.jl/stable/configuration/) for `MPI.jl`.

## Usage and tutorials
In order to get familiar with the library we recommend following the numerical examples described in:
In order to get familiar with the library we recommend following the numerical examples described in:

> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "LevelSetTopOpt.jl: A scalable computational toolbox for level set-based topology optimisation". In preparation.
> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "GridapTopOpt.jl: A scalable computational toolbox for level set-based topology optimisation". In preparation.
In addition, there are several driver scripts available in `/scripts/..`

More general tutorials for familiarising ones self with Gridap are available via the [Gridap Tutorials](https://gridap.github.io/Tutorials/dev/).

## Known issues
- PETSc's GAMG preconditioner breaks for split Dirichlet DoFs (e.g., x constrained while y free for a single node). There is no simple fix for this. We recommend instead using MUMPS or another preconditioner for this case.
- Currently, our implementation of automatic differentiation does not support multiplication and division of optimisation functionals. We plan to add this in a future release of `LevelSetTopOpt.jl` -- Issue [#38](https://github.com/zjwegert/LSTO_Distributed/issues/38).
- Analytic gradient breaks in parallel for integrals of certain measures -- Issue [#46](https://github.com/zjwegert/LSTO_Distributed/issues/46)
- Currently, our implementation of automatic differentiation does not support multiplication and division of optimisation functionals. We plan to add this in a future release of `GridapTopOpt.jl` -- Issue [#38](https://github.com/zjwegert/GridapTopOpt/issues/38).
- Analytic gradient breaks in parallel for integrals of certain measures -- Issue [#46](https://github.com/zjwegert/GridapTopOpt/issues/46)
10 changes: 5 additions & 5 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# LevelSetTopOpt.jl
Welcome to the documentation for `LevelSetTopOpt.jl`!
# GridapTopOpt.jl
Welcome to the documentation for `GridapTopOpt.jl`!

## Introduction
`LevelSetTopOpt.jl` is computational toolbox for level set-based topology optimisation implemented in Julia and the Gridap package ecosystem. The core design principle of `LevelSetTopOpt.jl` is to provide an extendable framework for solving optimisation problems in serial or parallel with a high-level programming interface and automatic differentiation. See the following publication for further details:
`GridapTopOpt.jl` is computational toolbox for level set-based topology optimisation implemented in Julia and the Gridap package ecosystem. The core design principle of `GridapTopOpt.jl` is to provide an extendable framework for solving optimisation problems in serial or parallel with a high-level programming interface and automatic differentiation. See the following publication for further details:

> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "LevelSetTopOpt.jl: A scalable computational toolbox for level set-based topology optimisation". In preparation.
> Zachary J. Wegert, Jordi Manyer, Connor Mallon, Santiago Badia, and Vivien J. Challis (2024). "GridapTopOpt.jl: A scalable computational toolbox for level set-based topology optimisation". In preparation.
## How to use this documentation

Expand All @@ -16,7 +16,7 @@ Welcome to the documentation for `LevelSetTopOpt.jl`!

## Julia educational resources

A basic knowledge of the Julia programming language is needed to use the `LevelSetTopOpt.jl` package.
A basic knowledge of the Julia programming language is needed to use the `GridapTopOpt.jl` package.
Here, one can find a list of resources to get started with this programming language.

* First steps to learn Julia form the [Gridap wiki](https://github.com/gridap/Gridap.jl/wiki/Start-learning-Julia) page.
Expand Down
16 changes: 8 additions & 8 deletions docs/src/reference/benchmarking.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Benchmarking

```@docs
LevelSetTopOpt.benchmark
GridapTopOpt.benchmark
```

## Existing benchmark methods
```@docs
LevelSetTopOpt.benchmark_optimizer
LevelSetTopOpt.benchmark_single_iteration
LevelSetTopOpt.benchmark_forward_problem
LevelSetTopOpt.benchmark_advection
LevelSetTopOpt.benchmark_reinitialisation
LevelSetTopOpt.benchmark_velocity_extension
LevelSetTopOpt.benchmark_hilbertian_projection_map
GridapTopOpt.benchmark_optimizer
GridapTopOpt.benchmark_single_iteration
GridapTopOpt.benchmark_forward_problem
GridapTopOpt.benchmark_advection
GridapTopOpt.benchmark_reinitialisation
GridapTopOpt.benchmark_velocity_extension
GridapTopOpt.benchmark_hilbertian_projection_map
```
66 changes: 33 additions & 33 deletions docs/src/reference/chainrules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
## `PDEConstrainedFunctionals`

```@docs
LevelSetTopOpt.PDEConstrainedFunctionals
LevelSetTopOpt.evaluate!
LevelSetTopOpt.evaluate_functionals!
LevelSetTopOpt.evaluate_derivatives!
LevelSetTopOpt.get_state
GridapTopOpt.PDEConstrainedFunctionals
GridapTopOpt.evaluate!
GridapTopOpt.evaluate_functionals!
GridapTopOpt.evaluate_derivatives!
GridapTopOpt.get_state
```

## `StateParamIntegrandWithMeasure`

```@docs
LevelSetTopOpt.StateParamIntegrandWithMeasure
LevelSetTopOpt.rrule(u_to_j::LevelSetTopOpt.StateParamIntegrandWithMeasure,uh,φh)
GridapTopOpt.StateParamIntegrandWithMeasure
GridapTopOpt.rrule(u_to_j::GridapTopOpt.StateParamIntegrandWithMeasure,uh,φh)
```

## Implemented types of `AbstractFEStateMap`

```@docs
LevelSetTopOpt.AbstractFEStateMap
GridapTopOpt.AbstractFEStateMap
```

### `AffineFEStateMap`
```@docs
LevelSetTopOpt.AffineFEStateMap
LevelSetTopOpt.AffineFEStateMap(a::Function,l::Function,U,V,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U,V),assem_adjoint = SparseMatrixAssembler(V,U),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),ls::LinearSolver = LUSolver(),adjoint_ls::LinearSolver = LUSolver())
GridapTopOpt.AffineFEStateMap
GridapTopOpt.AffineFEStateMap(a::Function,l::Function,U,V,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U,V),assem_adjoint = SparseMatrixAssembler(V,U),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),ls::LinearSolver = LUSolver(),adjoint_ls::LinearSolver = LUSolver())
```

### `NonlinearFEStateMap`
```@docs
LevelSetTopOpt.NonlinearFEStateMap
LevelSetTopOpt.NonlinearFEStateMap(res::Function,U,V,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U,V),assem_adjoint = SparseMatrixAssembler(V,U),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),nls::NonlinearSolver = NewtonSolver(LUSolver();maxiter=50,rtol=1.e-8,verbose=true),adjoint_ls::LinearSolver = LUSolver())
GridapTopOpt.NonlinearFEStateMap
GridapTopOpt.NonlinearFEStateMap(res::Function,U,V,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U,V),assem_adjoint = SparseMatrixAssembler(V,U),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),nls::NonlinearSolver = NewtonSolver(LUSolver();maxiter=50,rtol=1.e-8,verbose=true),adjoint_ls::LinearSolver = LUSolver())
```

### `RepeatingAffineFEStateMap`
```@docs
LevelSetTopOpt.RepeatingAffineFEStateMap
LevelSetTopOpt.RepeatingAffineFEStateMap(nblocks::Int,a::Function,l::Vector{<:Function},U0,V0,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U0,V0),assem_adjoint = SparseMatrixAssembler(V0,U0),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),ls::LinearSolver = LUSolver(),adjoint_ls::LinearSolver = LUSolver())
GridapTopOpt.RepeatingAffineFEStateMap
GridapTopOpt.RepeatingAffineFEStateMap(nblocks::Int,a::Function,l::Vector{<:Function},U0,V0,V_φ,U_reg,φh,dΩ...;assem_U = SparseMatrixAssembler(U0,V0),assem_adjoint = SparseMatrixAssembler(V0,U0),assem_deriv = SparseMatrixAssembler(U_reg,U_reg),ls::LinearSolver = LUSolver(),adjoint_ls::LinearSolver = LUSolver())
```

## Advanced
Expand All @@ -47,32 +47,32 @@ LevelSetTopOpt.RepeatingAffineFEStateMap(nblocks::Int,a::Function,l::Vector{<:Fu

#### Existing methods
```@docs
LevelSetTopOpt.rrule(φ_to_u::LevelSetTopOpt.AbstractFEStateMap,φh)
LevelSetTopOpt.pullback
GridapTopOpt.rrule(φ_to_u::GridapTopOpt.AbstractFEStateMap,φh)
GridapTopOpt.pullback
```

#### Required to implement
```@docs
LevelSetTopOpt.forward_solve!
LevelSetTopOpt.adjoint_solve!
LevelSetTopOpt.update_adjoint_caches!
LevelSetTopOpt.dRdφ
LevelSetTopOpt.get_state(::LevelSetTopOpt.AbstractFEStateMap)
LevelSetTopOpt.get_measure
LevelSetTopOpt.get_spaces
LevelSetTopOpt.get_assemblers
LevelSetTopOpt.get_trial_space
LevelSetTopOpt.get_test_space
LevelSetTopOpt.get_aux_space
LevelSetTopOpt.get_deriv_space
LevelSetTopOpt.get_pde_assembler
LevelSetTopOpt.get_deriv_assembler
GridapTopOpt.forward_solve!
GridapTopOpt.adjoint_solve!
GridapTopOpt.update_adjoint_caches!
GridapTopOpt.dRdφ
GridapTopOpt.get_state(::GridapTopOpt.AbstractFEStateMap)
GridapTopOpt.get_measure
GridapTopOpt.get_spaces
GridapTopOpt.get_assemblers
GridapTopOpt.get_trial_space
GridapTopOpt.get_test_space
GridapTopOpt.get_aux_space
GridapTopOpt.get_deriv_space
GridapTopOpt.get_pde_assembler
GridapTopOpt.get_deriv_assembler
```

### `IntegrandWithMeasure`

```@docs
LevelSetTopOpt.IntegrandWithMeasure
LevelSetTopOpt.gradient
LevelSetTopOpt.jacobian
GridapTopOpt.IntegrandWithMeasure
GridapTopOpt.gradient
GridapTopOpt.jacobian
```
Loading

0 comments on commit ed2c639

Please sign in to comment.