<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I use finite difference and, as an example, the discretization of Pxx is:</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
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-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I ran the code with valgrind and it seems there is a memory leak problem. <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I am trying to figure out what is causing the memory error. <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Sepideh<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Jed Brown <jed@jedbrown.org><br>
<b>Sent:</b> Tuesday, January 5, 2021 10:31 PM<br>
<b>To:</b> Matthew Knepley <knepley@gmail.com>; Barry Smith <bsmith@petsc.dev><br>
<b>Cc:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov>; Sepideh Kavousi <skavou1@lsu.edu><br>
<b>Subject:</b> Re: [petsc-users] convergence problem- 3D Cahn Hillard</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Matthew Knepley <knepley@gmail.com> writes:<br>
<br>
> On Tue, Jan 5, 2021 at 9:52 PM Barry Smith <bsmith@petsc.dev> wrote:<br>
><br>
>><br>
>> Ah, -snes_fd_color so it was already using finite differencing with<br>
>> coloring to compute the Jacobian which explains why the differences below<br>
>> are exactly zero.<br>
>><br>
>> Implicit time-step schemes essentially add terms like I/dt to the<br>
>> Jacobian evaluation (and the function defining the ODE) so for tiny<br>
>> time-steps the nonlinear system gets easier and easier to solve (the<br>
>> nonlinear function becomes linear) But we didn't see that with your earlier<br>
>> run where dt 3.72529e-13 (which is absurdly small). for tiny time-steps<br>
>> SNES still made no progress. It is hard to understand how this is possible,<br>
>> regardless of the problem you are solving.<br>
>><br>
>> I would next run the code with valgrind to insure there are no issues of<br>
>> memory corruption or un-initialized data.<br>
>><br>
>> How are you computing<br>
>><br>
>> (dp/dt)*(Pxx+Pyy+Pzz)<br>
>><br>
>><br>
>> That is, how are you computing Pxx etc?<br>
>><br>
>> Are you using finite elements for the U and P model? Exactly what elements?<br>
>><br>
><br>
> I agree with Barry. This does not seem to make sense, so I would expect<br>
> some kind of inconsistent discretization, or other<br>
> mathematical problem which makes your system unsolvable.<br>
<br>
Try -mat_fd_type ds before ruling out sensitivity to differencing parameter. <br>
</div>
</span></font></div>
</body>
</html>