New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hypre AMS Preconditioner #1643
Comments
This has been done (I did it with a former student) — I just haven’t committed it. It’s done through the Firedrake/PETSc interface, and we have a little loopy kernel that builds the gradient.
Currently it’s restricted to AMS (could be extended to ADS if you provide a discrete curl) and triangles, tets, and quads. And low-order methods.
I’ve shared with a few people in firedrake land but nobody has beat me to putting in a PR on it.
… On Apr 4, 2020, at 6:47 PM, florian98765 ***@***.***> wrote:
Dear Firedrake Developers,
I am currently using the Hypre AMS Preconditioner within FEniCS. I am wondering what are the missing pieces to make AMS work within Firedrake. As far as I can see to only missing thing is the build_gradient function which calculates the discrete gradient matrix, right?
Can the FEniCS code be adopted, or are there any further complicates which I don't see?
best wishes
Florian
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Currently this implementation assumes you use matrix-free outer matrices
(fishes out vertices, etc from a Python context associated with the
stiffness matrix). It should be fixable to have the preconditioner fish
things out elsewhere.
On Sat, Apr 4, 2020 at 8:27 PM Robert Kirby <robert.c.kirby@gmail.com>
wrote:
… This has been done (I did it with a former student) — I just haven’t
committed it. It’s done through the Firedrake/PETSc interface, and we have
a little loopy kernel that builds the gradient.
Currently it’s restricted to AMS (could be extended to ADS if you provide
a discrete curl) and triangles, tets, and quads. And low-order methods.
I’ve shared with a few people in firedrake land but nobody has beat me to
putting in a PR on it.
On Apr 4, 2020, at 6:47 PM, florian98765 ***@***.***> wrote:
Dear Firedrake Developers,
I am currently using the Hypre AMS Preconditioner within FEniCS. I am
wondering what are the missing pieces to make AMS work within Firedrake. As
far as I can see to only missing thing is the build_gradient function
which calculates the discrete gradient matrix, right?
Can the FEniCS code be adopted, or are there any further complicates which
I don't see?
best wishes
Florian
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1643>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4XUL3AMSZSIEFYH7V2VWLRK7BKBANCNFSM4L7OUT4Q>
.
|
Sounds perfect. I never used matrix-free "matrices", but I will give it a try. What about the beta poisson matrix, which could be passed to hypre? One last question: Is it possible to use this code with complex number support? best wishes |
I'd like to comment that firedrake also supports excellent geometric multigrid methods for problems in H(div) and H(curl). Using PCPATCH we can implement the Arnold-Falk-Winther scheme, which works for all H(div)/H(curl)-conforming elements of all degrees (in its vertex-patch version). Here's a demo code that solves the H(div) or H(curl) Riesz map. Try running it with
|
Great, I also talked with Matt Knepley about this (https://arxiv.org/pdf/1912.08516.pdf) and I would like to try it for our eddy current application. I am wondering if the code also works for the singular system without the mass term. best wishes |
Geometric MG in complex arithmetic isn’t quite done last I checked but is closer to AMG since hypre doesn’t support complex arithmetic. A sprint is scheduled later this month to finish and merge complex.
I don’t know about beta poisson or singular problems.
… On Apr 6, 2020, at 4:11 AM, florian98765 ***@***.***> wrote:
Great, I also talked with Matt Knepley about this (https://arxiv.org/pdf/1912.08516.pdf) and I would like to try it for our eddy current application.
I am wondering if the code also works for the singular system without the mass term.
While you solve (u,v) + alpha (curl u, curl(v) = (f,v), the eddy current system looks like (curl u, curl v) + j omega sigma (u,v) = (f,v). The conductivity sigma is zero in the non-conducting region, which leads to a singular system matrix. Is the method still working if the mass term is missing?
best wishes
Florian
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Dear Robert,
do you have an example code, which i can start from?
Thanks a lot.
Best wishes
Florian
On Mon, Apr 6, 2020 at 2:02 PM Robert Kirby <notifications@github.com>
wrote:
… Geometric MG in complex arithmetic isn’t quite done last I checked but is
closer to AMG since hypre doesn’t support complex arithmetic. A sprint is
scheduled later this month to finish and merge complex.
I don’t know about beta poisson or singular problems.
> On Apr 6, 2020, at 4:11 AM, florian98765 ***@***.***>
wrote:
>
> Great, I also talked with Matt Knepley about this (
https://arxiv.org/pdf/1912.08516.pdf) and I would like to try it for our
eddy current application.
>
> I am wondering if the code also works for the singular system without
the mass term.
> While you solve (u,v) + alpha (curl u, curl(v) = (f,v), the eddy current
system looks like (curl u, curl v) + j omega sigma (u,v) = (f,v). The
conductivity sigma is zero in the non-conducting region, which leads to a
singular system matrix. Is the method still working if the mass term is
missing?
>
> best wishes
> Florian
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or unsubscribe.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABY2Y6YMPQXCRAF2ABG6UEDRLHAF7ANCNFSM4L7OUT4Q>
.
|
Attached earlier in the thread.
…Sent from my iPhone
On Apr 9, 2020, at 2:19 AM, florian98765 ***@***.***> wrote:
Dear Robert,
do you have an example code, which i can start from?
Thanks a lot.
Best wishes
Florian
On Mon, Apr 6, 2020 at 2:02 PM Robert Kirby ***@***.***>
wrote:
> Geometric MG in complex arithmetic isn’t quite done last I checked but is
> closer to AMG since hypre doesn’t support complex arithmetic. A sprint is
> scheduled later this month to finish and merge complex.
>
> I don’t know about beta poisson or singular problems.
>
>
> > On Apr 6, 2020, at 4:11 AM, florian98765 ***@***.***>
> wrote:
> >
> > Great, I also talked with Matt Knepley about this (
> https://arxiv.org/pdf/1912.08516.pdf) and I would like to try it for our
> eddy current application.
> >
> > I am wondering if the code also works for the singular system without
> the mass term.
> > While you solve (u,v) + alpha (curl u, curl(v) = (f,v), the eddy current
> system looks like (curl u, curl v) + j omega sigma (u,v) = (f,v). The
> conductivity sigma is zero in the non-conducting region, which leads to a
> singular system matrix. Is the method still working if the mass term is
> missing?
> >
> > best wishes
> > Florian
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub, or unsubscribe.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <#1643 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ABY2Y6YMPQXCRAF2ABG6UEDRLHAF7ANCNFSM4L7OUT4Q>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Apparently the attachments aren't showing up. I will put in a PR, but it
might be after the weekend at this point.
On Thu, Apr 9, 2020 at 8:35 AM Robert Kirby <robert.c.kirby@gmail.com>
wrote:
… Attached earlier in the thread.
Sent from my iPhone
On Apr 9, 2020, at 2:19 AM, florian98765 ***@***.***> wrote:
Dear Robert,
do you have an example code, which i can start from?
Thanks a lot.
Best wishes
Florian
On Mon, Apr 6, 2020 at 2:02 PM Robert Kirby ***@***.***>
wrote:
> Geometric MG in complex arithmetic isn’t quite done last I checked but is
> closer to AMG since hypre doesn’t support complex arithmetic. A sprint is
> scheduled later this month to finish and merge complex.
>
> I don’t know about beta poisson or singular problems.
>
>
> > On Apr 6, 2020, at 4:11 AM, florian98765 ***@***.***>
> wrote:
> >
> > Great, I also talked with Matt Knepley about this (
> https://arxiv.org/pdf/1912.08516.pdf) and I would like to try it for our
> eddy current application.
> >
> > I am wondering if the code also works for the singular system without
> the mass term.
> > While you solve (u,v) + alpha (curl u, curl(v) = (f,v), the eddy
current
> system looks like (curl u, curl v) + j omega sigma (u,v) = (f,v). The
> conductivity sigma is zero in the non-conducting region, which leads to a
> singular system matrix. Is the method still working if the mass term is
> missing?
> >
> > best wishes
> > Florian
> >
> > —
> > You are receiving this because you commented.
> > Reply to this email directly, view it on GitHub, or unsubscribe.
>
> —
> You are receiving this because you authored the thread.
> Reply to this email directly, view it on GitHub
> <
#1643 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/ABY2Y6YMPQXCRAF2ABG6UEDRLHAF7ANCNFSM4L7OUT4Q
>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA4XUL72KBOVJ6HMEM5C37TRLVZIHANCNFSM4L7OUT4Q>
.
|
Hi @florian98765, A while ago I implemented function that builds discrete_gradient matrix, code is listed below:
This will probably be slow but it works. To upstream this we should generate a kernel that would assemble the matrix. |
@djanekovic : If I'm reading this correctly (and my apologies if I'm not), this works just for the lowest-order case. We should be able to do this more generally, since the discrete gradient is defined by interpolations of gradients of the Lagrange basis functions in the Nedelec space. That was difficult to do at some point in the past when I looked at it, but I think we have all the tools in place now to do it with generality. (This is on my personal to-do list, but buried deeply enough that I won't get to it in the next few weeks...) Also: the ERF preconditioner in [1] works quite well for the complex case, if one happens to have a problem of that form. [1] https://www.research-collection.ethz.ch/bitstream/handle/20.500.11850/103394/geo2015-0013.1.pdf |
Oh yeah, it's trivial:
Gives you a petsc matrix |
Thanks, @wence- ! I thought this was going to be easy now... |
And if you want ADS, you do
Note that this one doesn't just have +1/-1 in it for the lowest order case due to the scaling of the dofs for RT. |
Sounds great. Thanks for the update. Regarding the preconditioner Hypre AMS can also be called without Gradent Matrix. Instead one can provide either a coordinate array ( If I remember correctly, the code using One open problem that I am facing is that the method becomes unstable if Setting a small sigma does not hurt, but I am not sure if this is an expected behaviour? Nevertheless the code seems to work quite well, so I think this thread could be closed. Thanks for all comments, best wishes |
Hello, best wishes |
Hello, this is what I currently use. It is a slightly adapted version of the code that Rob Kirby provided.
The preconditioner can then be directly selected by passing the proper
|
@florian98765 since this comes up a lot, would you mind preparing your AMS preconditioner as one we can merge in Firedrake? It's mostly a case of creating a new file |
Yes, of course. I still had problems with the nonlinear solver, where the
context needed to be accessed in a slightly different way.
I will try to get a consistent version and create a merge request until
next week.
best wishes
Florian
…On Tue, Sep 22, 2020 at 6:37 PM Lawrence Mitchell ***@***.***> wrote:
@florian98765 <https://github.com/florian98765> since this comes up a
lot, would you mind preparing your AMS preconditioner as one we can merge
in Firedrake? It's mostly a case of creating a new file
firedrake/preconditioners/ams.py which contains the definition of the
HypreAMS class.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1643 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABY2Y64OLRCGAZB23HZRC2LSHDHF5ANCNFSM4L7OUT4Q>
.
|
Thank you for your kindness, I'll appreciate it. |
Dear Firedrake Developers,
I am currently using the Hypre AMS Preconditioner within FEniCS. I am wondering what are the missing pieces to make AMS work within Firedrake. As far as I can see to only missing thing is the
build_gradient
function which calculates the discrete gradient matrix, right?Can the FEniCS code be adopted, or are there any further complicates which I don't see?
best wishes
Florian
The text was updated successfully, but these errors were encountered: