You may also need https://petsc.org/release/manualpages/Mat/MatNullSpaceCreate/#matnullspacecreate and https://petsc.org/release/manualpages/Mat/MatSetNullSpace/
> On Jul 19, 2023, at 6:26 AM, Matthew Knepley <[email protected]> wrote: > > On Wed, Jul 19, 2023 at 6:23 AM Karthikeyan Chockalingam - STFC UKRI > <[email protected] > <mailto:[email protected]>> wrote: >> I finally found the answer to my problem. I was not wrongly imposing the >> periodic boundary condition but rather was solving a problem (Poisson >> equation with PBC), which has an infinite family of solutions. I was >> recommended to add an artificial constraint or use a null-space-aware >> algebraic solver. >> >> >> >> Are MUMPS and Hypre null-space-aware algebraic solvers? How can I turn that >> option on? >> > > MUMPS can do it with an option (it is in the documentation). For AMG you need > to specify the coarse solver. I know this works with GAMG, you use > > -mg_coarse_pc_type svd > > Thanks, > > Matt > >> Kind regards, >> >> Karthik. >> >> >> >> >> >> From: Matthew Knepley <[email protected] <mailto:[email protected]>> >> Date: Tuesday, 18 July 2023 at 17:22 >> To: Barry Smith <[email protected] <mailto:[email protected]>> >> Cc: Chockalingam, Karthikeyan (STFC,DL,HC) >> <[email protected] >> <mailto:[email protected]>>, [email protected] >> <mailto:[email protected]> <[email protected] >> <mailto:[email protected]>> >> Subject: Re: [petsc-users] periodic boundary conditions >> >> Jed creates the LocalToGlobal that does this elimination in plexsfc.c >> >> >> >> Thanks, >> >> >> >> Matt >> >> >> >> On Tue, Jul 18, 2023 at 12:07 PM Barry Smith <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> They are never really "eliminated" because extra copies in the global >> vector never exist. >> >> >> >> >> On Jul 18, 2023, at 12:03 PM, Karthikeyan Chockalingam - STFC UKRI >> <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> Thank you, Barry. I am using the MPIAIJ format for a Finite Element >> application. So, I am trying to understand what is implemented in DMDA to >> eliminate those extra nodes. >> >> >> >> Best, >> >> Karthik. >> >> >> >> From: Barry Smith <[email protected] <mailto:[email protected]>> >> Date: Tuesday, 18 July 2023 at 16:58 >> To: Chockalingam, Karthikeyan (STFC,DL,HC) >> <[email protected] >> <mailto:[email protected]>> >> Cc: Matthew Knepley <[email protected] <mailto:[email protected]>>, >> [email protected] <mailto:[email protected]> >> <[email protected] <mailto:[email protected]>> >> Subject: Re: [petsc-users] periodic boundary conditions >> >> >> >> If you are using DMDA with periodic boundary conditions for example only >> one "copy" of such nodes exists in the global vector (the vector the solvers >> see) so one does not need to eliminate extra ones >> >> >> >> On Jul 18, 2023, at 11:51 AM, Karthikeyan Chockalingam - STFC UKRI via >> petsc-users <[email protected] <mailto:[email protected]>> wrote: >> >> >> >> Yes, I clearly understand I need to eliminate one set of periodic nodes. I >> was hoping to use x = P x’ to eliminate one set. It is a kind of mapping. >> >> >> >> Sorry, I am not sure if it is the LocalToGlobal mapping you are referring >> to. Is there an example or reference to show how the LocalToGlobal mapping >> is being used to impose PBC? >> >> >> >> Best, >> >> Karthik. >> >> >> >> >> >> From: Matthew Knepley <[email protected] <mailto:[email protected]>> >> Date: Tuesday, 18 July 2023 at 16:38 >> To: Chockalingam, Karthikeyan (STFC,DL,HC) >> <[email protected] >> <mailto:[email protected]>> >> Cc: [email protected] <mailto:[email protected]> >> <[email protected] <mailto:[email protected]>> >> Subject: Re: [petsc-users] periodic boundary conditions >> >> On Tue, Jul 18, 2023 at 11:18 AM Karthikeyan Chockalingam - STFC UKRI >> <[email protected] >> <mailto:[email protected]>> wrote: >> >> Thanks Matt. >> >> >> >> The mesh is structured (rectilinear), so it is periodic in that sense. >> >> >> >> Can you please explain how I can impose it strongly? >> >> >> >> Strongly means make those variables equal in a pointwise sense. We do this >> in the >> >> LocalToGlobal mapping, so one set is eliminated in the global problem. >> >> >> >> Thanks, >> >> >> >> Matt >> >> >> >> My initial thought was to come up with a relation between the periodic nodes: >> >> >> >> x = P x’ >> >> >> >> Say for 1-D problem with two elements >> >> (1)-------------(2)------------(3) >> >> >> >> P = [1 0, 0 1, 1 0] >> >> x = [x1 x2 x3] >> >> x’ = [x1 x2] >> >> >> >> and solve >> >> [P^T A P] x’ = P^T b >> >> >> >> I don’t think [P^T A P] is deterministic. >> >> >> >> Kind regards, >> >> Karthik. >> >> >> >> >> >> From: Matthew Knepley <[email protected] <mailto:[email protected]>> >> Date: Tuesday, 18 July 2023 at 14:31 >> To: Chockalingam, Karthikeyan (STFC,DL,HC) >> <[email protected] >> <mailto:[email protected]>> >> Cc: [email protected] <mailto:[email protected]> >> <[email protected] <mailto:[email protected]>> >> Subject: Re: [petsc-users] periodic boundary conditions >> >> On Tue, Jul 18, 2023 at 9:02 AM Karthikeyan Chockalingam - STFC UKRI via >> petsc-users <[email protected] <mailto:[email protected]>> wrote: >> >> Hello, >> >> >> >> This is exactly not a PETSc question. I am solving a Poisson equation using >> finite elements. I would like to impose PBC. I am thinking of using the >> Lagrange multiplier method to impose them as constraints. Or do you think I >> could take an alternative approach? >> >> >> >> There are several options: >> >> >> >> 1) Just make a periodic mesh. This is what Plex does by default. >> >> >> >> 2) Impose the conditions strongly. This is what is done if you create the >> ZBox shape in Plex. >> >> >> >> 3) Impose the conditions weakly. This is what you are doing with Lagrange >> multipliers. You could >> >> also do a Nitsche boundary condition for this. >> >> >> >> Since the constraint is so simple, I do not see an advantage to imposing it >> weakly. >> >> >> >> Thanks, >> >> >> >> Matt >> >> >> >> Thank you for your help. >> >> >> >> Kind regards, >> >> Karthik. >> >> >> >> -- >> >> Dr. Karthik Chockalingam >> >> High Performance Software Engineering Group >> >> Hartree Centre | Science and Technology Facilities Council >> >> [email protected] >> <mailto:[email protected]> >> >> >> <image001.png> >> >> >> >> >> >> >> >> -- >> >> What most experimenters take for granted before they begin their experiments >> is infinitely more interesting than any results to which their experiments >> lead. >> -- Norbert Wiener >> >> >> >> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/> >> >> >> >> -- >> >> What most experimenters take for granted before they begin their experiments >> is infinitely more interesting than any results to which their experiments >> lead. >> -- Norbert Wiener >> >> >> >> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/> >> >> >> >> >> >> >> -- >> >> What most experimenters take for granted before they begin their experiments >> is infinitely more interesting than any results to which their experiments >> lead. >> -- Norbert Wiener >> >> >> >> https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/> > > -- > What most experimenters take for granted before they begin their experiments > is infinitely more interesting than any results to which their experiments > lead. > -- Norbert Wiener > > https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
