<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div><br></div> 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 <br><div><br><blockquote type="cite"><div>On Jul 18, 2023, at 11:51 AM, Karthikeyan Chockalingam - STFC UKRI via petsc-users <petsc-users@mcs.anl.gov> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Yes, I clearly understand I need to eliminate one set of periodic nodes. I was hoping to use<span class="Apple-converted-space"> </span></span><span style="font-size: 11pt;">x = P x’ to eliminate one set. It is a kind of mapping.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Sorry, I am not sure if it is the<span class="Apple-converted-space"> </span></span><span style="font-size: 11pt;">LocalToGlobal mapping you are referring to. Is there an example or reference to show how<span class="Apple-converted-space"> </span></span><span style="font-size: 11pt;">the<span class="Apple-converted-space"> </span></span><span style="font-size: 11pt;">LocalToGlobal mapping is being used to impose PBC?<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Best,<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Karthik.</span><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div><div id="mail-editor-reference-message-container"><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;"><p class="MsoNormal" style="margin: 0cm 0cm 12pt; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 12pt;">From:<span class="Apple-converted-space"> </span></span></b><span style="font-size: 12pt;">Matthew Knepley <<a href="mailto:knepley@gmail.com" style="color: blue; text-decoration: underline;">knepley@gmail.com</a>><br><b>Date:<span class="Apple-converted-space"> </span></b>Tuesday, 18 July 2023 at 16:38<br><b>To:<span class="Apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <<a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" style="color: blue; text-decoration: underline;">karthikeyan.chockalingam@stfc.ac.uk</a>><br><b>Cc:<span class="Apple-converted-space"> </span></b><a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a><span class="Apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov" style="color: blue; text-decoration: underline;">petsc-users@mcs.anl.gov</a>><br><b>Subject:<span class="Apple-converted-space"> </span></b>Re: [petsc-users] periodic boundary conditions<o:p></o:p></span></p></div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">On Tue, Jul 18, 2023 at 11:18 AM Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" style="color: blue; text-decoration: underline;"><span style="font-size: 11pt;">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size: 11pt;">> wrote:<o:p></o:p></span></div></div><div><blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: currentcolor currentcolor currentcolor rgb(204, 204, 204); border-image: none; padding: 0cm 0cm 0cm 6pt; margin: 5pt 0cm 5pt 4.8pt;"><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Thanks Matt.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">The mesh is structured (rectilinear), so it is periodic in that sense.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Can you please explain how I can impose it strongly?<o:p></o:p></span></div></div></div></div></blockquote><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Strongly means make those variables equal in a pointwise sense. We do this in the<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">LocalToGlobal mapping, so one set is eliminated in the global problem.<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Thanks,<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Matt<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: currentcolor currentcolor currentcolor rgb(204, 204, 204); border-image: none; padding: 0cm 0cm 0cm 6pt; margin: 5pt 0cm 5pt 4.8pt;"><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">My initial thought was to come up with a relation between the periodic nodes:<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">x = P x’<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Say for 1-D problem with two elements<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">(1)-------------(2)------------(3)<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">P = [1 0, 0 1, 1 0]<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">x = [x1 x2 x3]<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">x’ = [x1 x2]<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">and solve<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">[P^T A P] x’ = P^T b<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">I don’t think [P^T A P] is deterministic.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Kind regards,<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Karthik.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div id="m_-6387936294348734192mail-editor-reference-message-container"><div><div style="border-width: 1pt medium medium; border-style: solid none none; border-color: rgb(181, 196, 223) currentcolor currentcolor; border-image: none; padding: 3pt 0cm 0cm;"><p class="MsoNormal" style="margin: 0cm 0cm 12pt; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 12pt;">From:<span class="Apple-converted-space"> </span></span></b><span style="font-size: 12pt;">Matthew Knepley <</span><a href="mailto:knepley@gmail.com" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 12pt;">knepley@gmail.com</span></a><span style="font-size: 12pt;">><br><b>Date:<span class="Apple-converted-space"> </span></b>Tuesday, 18 July 2023 at 14:31<br><b>To:<span class="Apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 12pt;">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size: 12pt;">><br><b>Cc:<span class="Apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 12pt;">petsc-users@mcs.anl.gov</span></a><span style="font-size: 12pt;"><span class="Apple-converted-space"> </span><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 12pt;">petsc-users@mcs.anl.gov</span></a><span style="font-size: 12pt;">><br><b>Subject:<span class="Apple-converted-space"> </span></b>Re: [petsc-users] periodic boundary conditions</span><span style="font-size: 11pt;"><o:p></o:p></span></p></div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">On Tue, Jul 18, 2023 at 9:02 AM Karthikeyan Chockalingam - STFC UKRI via petsc-users <</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 11pt;">petsc-users@mcs.anl.gov</span></a><span style="font-size: 11pt;">> wrote:<o:p></o:p></span></div></div><div><blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: currentcolor currentcolor currentcolor rgb(204, 204, 204); border-image: none; padding: 0cm 0cm 0cm 6pt; margin: 5pt 0cm 5pt 4.8pt;"><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Hello,<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">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?<o:p></o:p></span></div></div></div></div></blockquote><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">There are several options:<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">1) Just make a periodic mesh. This is what Plex does by default.<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">2) Impose the conditions strongly. This is what is done if you create the ZBox shape in Plex.<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">3) Impose the conditions weakly. This is what you are doing with Lagrange multipliers. You could<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">also do a Nitsche boundary condition for this.<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Since the constraint is so simple, I do not see an advantage to imposing it weakly.<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Thanks,<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> Matt<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><blockquote style="border-width: medium medium medium 1pt; border-style: none none none solid; border-color: currentcolor currentcolor currentcolor rgb(204, 204, 204); border-image: none; padding: 0cm 0cm 0cm 6pt; margin: 5pt 0cm 5pt 4.8pt;"><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Thank you for your help.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Kind regards,<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">Karthik.<o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">-- <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(45, 45, 98);">Dr. Karthik Chockalingam</span></b><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(65, 65, 65);">High Performance Software Engineering Group</span><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(65, 65, 65);">Hartree Centre | Science and Technology Facilities Council</span><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(5, 99, 193);">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 12pt; font-family: "Times New Roman", serif;"> </span><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(65, 65, 65);"> </span><span style="font-size: 11pt;"><o:p></o:p></span></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 10.5pt; font-family: Arial, sans-serif; color: rgb(65, 65, 65);"> </span></b><span style="font-size: 12pt; font-family: "Times New Roman", serif; color: rgb(31, 73, 125);"><span id="cid:18969a5f55a4cff311"><image001.png></span></span><span style="font-size: 11pt;"><o:p></o:p></span></div></div></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div></div></div></blockquote></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><br clear="all"><o:p></o:p></span></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span class="m-6387936294348734192gmailsignatureprefix"><span style="font-size: 11pt;">--</span></span><span style="font-size: 11pt;"><o:p></o:p></span></div><div><div><div><div><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"> <o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 11pt;">https://www.cse.buffalo.edu/~knepley/</span></a><span style="font-size: 11pt;"><o:p></o:p></span></div></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><br clear="all"><o:p></o:p></span></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span class="gmailsignatureprefix"><span style="font-size: 11pt;">--</span></span><span style="font-size: 11pt;"><o:p></o:p></span></div><div><div><div><div><div><div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<o:p></o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><span style="font-size: 11pt;"><o:p> </o:p></span></div></div><div><div style="margin: 0cm; font-size: 10pt; font-family: Calibri, sans-serif;"><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank" style="color: blue; text-decoration: underline;"><span style="font-size: 11pt;">https://www.cse.buffalo.edu/~knepley/</span></a></div></div></div></div></div></div></div></div></div></div></div></div></div></blockquote></div><br></body></html>