<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><br class=""></div>  It looks like valgrind is being run on bash, not on your program, so these leaks are not relevant.  by 0x41C482: main (in /usr/bin/bash)<div class=""><br class=""></div><div class="">  So the entire code is finite difference based?<br class=""><div class=""><br class=""></div><div class="">  Barry</div><div class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Jan 7, 2021, at 12:48 PM, Sepideh Kavousi <<a href="mailto:skavou1@lsu.edu" class="">skavou1@lsu.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I use finite difference and, as an example,  the discretization of Pxx is:</div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""> Pxx=((aY[k][j][i+1].p+aY[k][j][i-1].p-2.0*aY[k][j][i].p)/hx2);</div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I ran the code with valgrind and it seems there is a memory leak problem.<span class="Apple-converted-space"> </span><br class=""></div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">I am trying to figure out what is causing the memory error.<span class="Apple-converted-space"> </span><br class=""></div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Best,</div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class="">Sepideh<br class=""></div><div 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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;" class=""><br class=""></div><div id="appendonsend" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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;" class=""></div><hr tabindex="-1" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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; display: inline-block; width: 1138.75px;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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; float: none; display: inline !important;" class=""></span><div id="divRplyFwdMsg" dir="ltr" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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;" class=""><font face="Calibri, sans-serif" style="font-size: 11pt;" class=""><b class="">From:</b><span class="Apple-converted-space"> </span>Jed Brown <<a href="mailto:jed@jedbrown.org" class="">jed@jedbrown.org</a>><br class=""><b class="">Sent:</b><span class="Apple-converted-space"> </span>Tuesday, January 5, 2021 10:31 PM<br class=""><b class="">To:</b><span class="Apple-converted-space"> </span>Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>>; Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>><br class=""><b class="">Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a><span class="Apple-converted-space"> </span><<a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a>>; Sepideh Kavousi <<a href="mailto:skavou1@lsu.edu" class="">skavou1@lsu.edu</a>><br class=""><b class="">Subject:</b><span class="Apple-converted-space"> </span>Re: [petsc-users] convergence problem- 3D Cahn Hillard</font><div class=""> </div></div><div class="BodyFragment" style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 18px; 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="2" class=""><span style="font-size: 11pt;" class=""><div class="PlainText">Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> writes:<br class=""><br class="">> On Tue, Jan 5, 2021 at 9:52 PM Barry Smith <<a href="mailto:bsmith@petsc.dev" class="">bsmith@petsc.dev</a>> wrote:<br class="">><br class="">>><br class="">>> Ah, -snes_fd_color so it was already using finite differencing with<br class="">>> coloring to compute the Jacobian which explains why the differences below<br class="">>> are exactly zero.<br class="">>><br class="">>> Implicit time-step schemes essentially add terms like I/dt  to the<br class="">>> Jacobian evaluation (and the function defining the ODE) so for tiny<br class="">>> time-steps the nonlinear system gets easier and easier to solve (the<br class="">>> nonlinear function becomes linear) But we didn't see that with your earlier<br class="">>> run where  dt 3.72529e-13 (which is absurdly small).  for tiny time-steps<br class="">>> SNES still made no progress. It is hard to understand how this is possible,<br class="">>> regardless of the problem you are solving.<br class="">>><br class="">>> I would next run the code with valgrind to insure there are no issues of<br class="">>> memory corruption or un-initialized data.<br class="">>><br class="">>> How are you computing<br class="">>><br class="">>> (dp/dt)*(Pxx+Pyy+Pzz)<br class="">>><br class="">>><br class="">>> That is, how are you computing Pxx etc?<br class="">>><br class="">>> Are you using finite elements for the U and P model? Exactly what elements?<br class="">>><br class="">><br class="">> I agree with Barry. This does not seem to make sense, so I would expect<br class="">> some kind of inconsistent discretization, or other<br class="">> mathematical problem which makes your system unsolvable.<br class=""><br class="">Try -mat_fd_type ds before ruling out sensitivity to differencing parameter.<span class="Apple-converted-space"> </span><br class=""></div></span></font></div><span id="cid:379E0871-2E6B-4FA3-9F4D-5375EF45EBF9"><valgrind-out.txt></span></div></blockquote></div><br class=""></div></div></body></html>