<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hi Zakariae - sorry about the delay - responses inline below.<div class=""><br class=""></div><div class="">I'd be curious to see your code (which you can send directly to me if you don't want to post it publicly), so I can give you more comments, as DMStag is a new component. <br class=""><div class=""><br class=""></div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Am 23.03.2021 um 00:54 schrieb Jorti, Zakariae <<a href="mailto:zjorti@lanl.gov" class="">zjorti@lanl.gov</a>>:</div><br class="Apple-interchange-newline"><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; 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; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class="">Hi, </div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><br class=""></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">I implemented a PETSc code to solve Maxwell's equations for the magnetic and electric fields (B and E) in a cylinder: </div><div style="margin-top: 0px; margin-bottom: 0px;" class="">0 < r_min <= r <= r_max; with <span style="font-size: 12pt;" class="">r_max</span><span style="font-size: 12pt;" class=""> > r_min</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class="">phi_min = 0 <span style="font-size: 12pt;" class=""><= r <= phi_max</span><span style="font-size: 12pt;" class=""> = 2 </span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">π</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">z_min <= z =< z_max; </span><span style="font-size: 12pt;" class="">with </span><span style="font-size: 12pt;" class="">z_max</span><span style="font-size: 12pt;" class=""> > z_min.</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><font size="3" class="">I am using a PETSc staggered grid with the electric field E defined on edge centers and the magnetic field B </font>defined<font size="3" class=""> on face centers. (</font><span style="font-size: 12pt;" class="">dof0 = 0, dof1 = 1,dof2 = 1, dof3 = 0;</span><font size="3" class="">). </font><font size="3" class=""> </font></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; 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; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt;" class=""></span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">I have two versions of my code: </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><font face="Calibri, Helvetica, sans-serif" size="3" class="">1 - A first version<span class="Apple-converted-space"> </span></font><font face="Calibri, Helvetica, sans-serif" class="">in which I set the boundary type to DM_BOUNDARY_NONE in the three directions r, phi and z</font></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">2- A second version in which I set </span><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">the boundary type to DM_BOUNDARY_NONE in the r and z directions</span><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">, </span><font face="Calibri, Helvetica, sans-serif" size="3" class="">and DM_BOUNDARY_PERIODIC in the phi di</font><font face="Calibri, Helvetica, sans-serif" class="">rection.</font><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""> </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">When I print the solution vector X, which contains both E and B components, I notice that the vector is shorter with the second version compared to the first one. </span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">Is it normal? </span></div></div></div></blockquote>Yes - with the periodic boundary conditions, there will be fewer points since there won't be the "extra" layer of faces and edges at phi = 2 * pi .</div><div><br class=""></div><div>If you consider a 1-d example with 1 dof on vertices and cells, with three elements, the periodic case looks like this, globally,</div><div><br class=""></div><div> x ---- x ---- x ----</div><div><br class=""></div><div>as opposed to the non-periodic case,</div><div><br class=""></div><div> x ---- x ---- x ---- x</div><div><br class=""></div><div><br class=""></div><div><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; 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; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">Besides, I was wondering if I have to change the way I define the value of the solution on the boundary. What I am doing so far in both versions is something like:</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">B_phi [phi = 0] = 1.0;</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif;" class="">B_phi </span><span style="font-family: Calibri, Helvetica, sans-serif;" class="">[phi = 2</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">π</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">] = 1.0;</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">E_z [r, phi = 0</span><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">] = 1/r;</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">E_z [r, phi = 2</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">π</span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">] = 1/r;</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><font face="Calibri, Helvetica, sans-serif" class="">Assuming that values at phi = 0 should be the same as at phi=2</font><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">π with the periodic boundary conditions, </span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">is it sufficient for example </span><font face="Calibri, Helvetica, sans-serif" size="3" class="">to </font><font face="Calibri, Helvetica, sans-serif" class="">have</font><font face="Calibri, Helvetica, sans-serif" size="3" class=""> only the following boundary conditions</font><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">:</span></div><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class="">B_phi [phi = 0] = 1.0;</span></div><p style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""></span></p><div style="margin-top: 0px; margin-bottom: 0px;" class=""><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">E_z [r, phi = 0</span><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">] = 1/r ? </span><span style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></span></div></div></div></blockquote><div><br class=""></div>Yes - this is the intention, since the boundary at phi = 2 * pi is represented by the same entries in the global vector. </div><div><br class=""></div><div>Of course, you need to make sure that your continuous problem is well-posed, which in general could change when using different boundary conditions. </div><div><br class=""><blockquote type="cite" class=""><div class=""><div id="divtagdefaultwrapper" dir="ltr" style="font-style: normal; font-variant-caps: normal; font-weight: normal; 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; font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class=""><div class=""><span style="font-size: 12pt; font-family: Calibri, Helvetica, sans-serif;" class="">Thank you.</span></div><div class=""><font face="Calibri, Helvetica, sans-serif" class="">Best regards,</font></div><div class=""><font face="Calibri, Helvetica, sans-serif" class=""><br class=""></font></div><div class=""><font face="Calibri, Helvetica, sans-serif" class="">Zakariae Jorti</font></div></div></div></blockquote></div><br class=""></div></div></body></html>