<div dir="ltr"><div dir="ltr">On Tue, May 12, 2020 at 4:21 AM Shashwat Tiwari <<a href="mailto:shaswat121994@gmail.com">shaswat121994@gmail.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi, <br></div><div>I am trying to write a second order upwind finite volume scheme on unstructured grid using DMPlex. I am performing gradient reconstruction using the "DMPlexReconstructGradientsFVM" function as well as a "ComputeGradient" function that I have written myself, in which, I loop over faces and add the gradient contribution to neighboring cells of the face (similar to what is done in "DMPlexReconstructGradients_Internal") . The results don't seem correct when using the "DMPlexReconstructGradientsFVM" function where as when using my own function, the second order is achieved. To investigate, I looked at the gradients computed by these two functions, and noticed that "DMPlexReconstructGradientsFVM" assigns a zero value to the gradient of cells with less than three neighbors, for example, boundary cells (which I assume is because leastsquares requires over-constrained system of equations and hence, atleast three neighbors), where as, I am not considering this factor in my "ComputeGradient" function and adding the contribution to neighboring cells for all interior and partition faces. Other than this, both the functions seem to compute similar values for gradients on all the other cells and I suspect, zero values for certain cells might be causing the problem. I wanted to know if I am missing out on some crucial step in the code which would enable the "DMPlexReconstructGradientsFVM" function to compute gradients for cells with lesser number of neighbors, and also if there is a way to augment the leastsquares stencil, i.e. to use, say, vertex neighbors instead of face neighbors to reconstruct gradients. Also, kindly let me know if my analysis of the problem is wrong and if there might be some other issue.</div></div></blockquote><div><br></div><div>I am sure you are right. It should be possible to do exactly as you say in DMPlexReconstructGradientsFVM(). I must have just messed it up in the initial implementtion. If</div><div>you want to make a simple MR, or send your patch, I can help get it integrated.</div><div><br></div><div> Thanks!</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM">I am attaching my code for your reference. You can find the use of both "DMPlexReconstructGradientsFVM" function and "ComputeGradient" function (just uncomment the one you want to use) inside "ComputeResidual" function. I am also attaching the Gmsh file for the mesh I am using. You can run the code as follows:</a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM"> mpiexec -n <NumProc> ./convect -mesh square_tri.msh<br></a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM"><br></a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM"> Please let me know if you need anything else.</a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM"><br></a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM">Thanks and Regards,</a></div><div><a name="m_-5614861603181718197_DMPlexReconstructGradientsFVM">Shashwat<br></a></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>