# \[ANN\] Announcing GeometricMultigrid.jl

**URL:** <https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754>\
**Category:** Package Announcements\
**Tags:** package, announcement, linearalgebra\
**Created:** [September 25, 2021, 5:21pm UTC](https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754 "2021-09-25T17:21:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![weymouth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/weymouth/32/15839_2.png) [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Post date:** [September 25, 2021, 5:21pm UTC](https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754/1 "2021-09-25T17:21:44Z")

</div>

Just a heads-up announcing [GeometricMultigrid.jl](https://github.com/weymouth/GeometricMultigrid.jl) is now registered, for anyone who is interested.

![MGscaling](https://global.discourse-cdn.com/julialang/original/3X/3/1/319a5d0b2472137ae0391f477b841ccc28f82490.png)  
Benchmark example for `mg!` solver demonstrating `NlogN` solution time scaling with the length of the solution vector.

* * *

The only _clever_ (?) bit of the implementation is a few custom types. Geometric Multigrid methods make use of the regular spacial connectivity of the grid to define the _restriction_ and _prolongation_ operators. These concepts are built into the package using the `FieldVector` and `FieldMatrix` types. These behave like `Vector` and `Matrix` types, but they are actually wrappers around multi-dimensional padded arrays which efficiently capture the geometric structure of the data. These along with a recursive `SolveState` type are enough to define a pretty fast implementation.

Since I only use this for discrete Poisson equations, `FieldMatrix` is not very general yet. If anyone is interested in using this for other discrete PDEs, we can certainly extend the type.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [September 25, 2021, 6:22pm UTC](https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754/2 "2021-09-25T18:22:12Z")

</div>

Glad to see this! There is also [https://github.com/timholy/RestrictProlong.jl](https://github.com/timholy/RestrictProlong.jl). To be clear, there is no associated solver, just the operators themselves, which is why I’m glad to see this package. But maybe if you’re looking for generalizability it might be worth a look and see if it meets some needs?

---

<div class="post-metadata">

**Author:** ![weymouth](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/weymouth/32/15839_2.png) [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Post date:** [September 25, 2021, 7:19pm UTC](https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754/3 "2021-09-25T19:19:46Z")

</div>

Great! Thanks for the heads up.

It’s interesting that you mention the Galerkin condition. I’m working with conservative PDEs, so the summation restriction operation is effectively exact, but I’m not sure what the transpose projection operation is…

As far as generality, looking at your implementation points out a number of geometric assumptions I’ve made. It might be good to chat about what grid your operations are implying and if there is a way to construct a general set of functions.

---

<div class="post-metadata">

**Author:** ![tim.holy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tim.holy/32/52_2.png) [@tim.holy](https://discourse.julialang.org/u/tim.holy)\
**Post date:** [September 25, 2021, 7:35pm UTC](https://discourse.julialang.org/t/ann-announcing-geometricmultigrid-jl/68754/4 "2021-09-25T19:35:43Z")

</div>

My package makes its own assumptions. It’s targeted at regularly-spaced grids. Agreed that it’s a challenging problem, but multiple dispatch might come to the rescue? As you can tell from the modification dates of the package, it’s not something I’ve thought about in a while, but it comes up periodically so it remains of interest.
