Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 4:32 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > Great. Thank you for letting me know. > > I got the reference to KSP as well from libmesh and I am not creating a > new KSP. > > This time around, I didn’t have to set the PC type an

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Great. Thank you for letting me know. I got the reference to KSP as well from libmesh and I am not creating a new KSP. This time around, I didn’t have to set the PC type and it seems to work. petscErr = PetscOptionsSetValue(NULL,"-ksp_type", "gmres"); petscErr = PetscOptionsSetValue(NULL,"-pc_

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 4:03 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > I never explicitly called KSPGetPC(). I am embedding AMS in a libmesh > (fem) example. So, I only got the reference to pc from libmesh and set > petscErr > = PCHYPRESetDiscreteGra

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
I never explicitly called KSPGetPC(). I am embedding AMS in a libmesh (fem) example. So, I only got the reference to pc from libmesh and set petscErr = PCHYPRESetDiscreteGradient(pc, par_G); From: Matthew Knepley Date: Monday, 9 September 2024 at 20:57 To: Chockalingam, Karthikeyan (STFC,DL,H

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 3:38 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > I didn’t know how to check the pc type but adding > > petscErr = PCSetType(pc, "hypre"); > > before the two functions made it to work. > > > > But how does it work from the command l

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
I didn’t know how to check the pc type but adding petscErr = PCSetType(pc, "hypre"); before the two functions made it to work. But how does it work from the command line? For summary: KSPCreate(mesh.comm().get(), &ksp); petscErr = PetscOptionsSetValue(NULL,"-ksp_type", "gmres"); petscErr =

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 2:18 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > Calling the two functions after KSPSetFromOptions() did not work either. > Can you check that the PC has the correct type when you call it? Thanks, Matt > Everything work

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Calling the two functions after KSPSetFromOptions() did not work either. Everything works from the command line. I haven’t set KSPSetOperators, not sure if that is an issue. From: Matthew Knepley Date: Monday, 9 September 2024 at 19:09 To: Chockalingam, Karthikeyan (STFC,DL,HC) Cc: Stefano Zampi

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 1:21 PM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > Hi Stefano, > > > > Thank you. That was helpful. I tried the following: > > > > petscErr = PetscOptionsSetValue(NULL,"-ksp_type", "gmres"); > > petscErr = PetscOptionsSetValue(NU

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Hi Stefano, Thank you. That was helpful. I tried the following: petscErr = PetscOptionsSetValue(NULL,"-ksp_type", "gmres"); petscErr = PetscOptionsSetValue(NULL,"-pc_type", "hypre"); petscErr = PetscOptionsSetValue(NULL,"-pc_hypre_type", "ams"); // Set discrete gradient petscErr = PCHY

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Stefano Zampini
I would say the best way is to look at the source code https://urldefense.us/v3/__https://gitlab.com/petsc/petsc/-/blob/main/src/ksp/pc/impls/hypre/hypre.c?ref_type=heads*L2061__;Iw!!G_uCfscf7eWS!b8Tv_XEoRSSehhvrYTELfhg0W08IjaDPGx3gkioYVRlIia4rZz7XLH7GXmXmEbathoNXMMfFaU8hWftak1IUQLf7BSgg7vg$ htt

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Matthew Knepley
On Mon, Sep 9, 2024 at 10:17 AM Karthikeyan Chockalingam - STFC UKRI < karthikeyan.chockalin...@stfc.ac.uk> wrote: > Hi Matt, > > > > You mentioned it doesn’t hurt to set the smoothing flags > > > > > https://urldefense.us/v3/__https://github.com/hypre-space/hypre/blob/3caa81955eb8d1b4e35d9b450e27

Re: [petsc-users] Hypre AMS usage

2024-09-09 Thread Karthikeyan Chockalingam - STFC UKRI via petsc-users
Hi Matt, You mentioned it doesn’t hurt to set the smoothing flags https://urldefense.us/v3/__https://github.com/hypre-space/hypre/blob/3caa81955eb8d1b4e35d9b450e27cf6d07b50f6e/src/examples/ex15.c*L965__;Iw!!G_uCfscf7eWS!ab7xBNMnurfBQihWzSOZdJKuuhPObxZolYSuACYpW4-NN7L84moQXv7vO962vvaVT3soXUhcCaNH6