<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);">
Yes, the entire code is finite difference. <br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Is it possible that the large Laplacian term makes the equation stiff, such that the time step is reduced to solve the problem?</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 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> Barry Smith <bsmith@petsc.dev><br>
<b>Sent:</b> Thursday, January 7, 2021 1:38 PM<br>
<b>To:</b> Sepideh Kavousi <skavou1@lsu.edu><br>
<b>Cc:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] convergence problem- 3D Cahn Hillard</font>
<div> </div>
</div>
<div class="" style="word-wrap:break-word; line-break:after-white-space">
<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="x_Apple-interchange-newline">
<div class="">
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
I use finite difference and, as an example,  the discretization of Pxx is:</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
 Pxx=((aY[k][j][i+1].p+aY[k][j][i-1].p-2.0*aY[k][j][i].p)/hx2);</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
I ran the code with valgrind and it seems there is a memory leak problem.<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
I am trying to figure out what is causing the memory error.<span class="x_Apple-converted-space"> </span><br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Best,</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
Sepideh<br class="">
</div>
<div class="" 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; text-decoration:none; font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt">
<br class="">
</div>
<div id="x_appendonsend" class="" style="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; text-decoration:none">
</div>
<hr tabindex="-1" class="" style="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; text-decoration:none; display:inline-block; width:1138.75px">
<span class="" style="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; text-decoration:none; float:none; display:inline!important"></span>
<div id="x_divRplyFwdMsg" dir="ltr" class="" style="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; text-decoration:none">
<font face="Calibri, sans-serif" class="" style="font-size:11pt"><b class="">From:</b><span class="x_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="x_Apple-converted-space"> </span>Tuesday, January 5, 2021 10:31 PM<br class="">
<b class="">To:</b><span class="x_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="x_Apple-converted-space"> </span><a href="mailto:petsc-users@mcs.anl.gov" class="">petsc-users@mcs.anl.gov</a><span class="x_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="x_Apple-converted-space"> </span>Re: [petsc-users] convergence problem- 3D Cahn Hillard</font>
<div class=""> </div>
</div>
<div class="x_BodyFragment" style="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; text-decoration:none">
<font size="2" class=""><span class="" style="font-size:11pt">
<div class="x_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="x_Apple-converted-space"> </span><br class="">
</div>
</span></font></div>
<span id="x_cid:379E0871-2E6B-4FA3-9F4D-5375EF45EBF9"><valgrind-out.txt></span></div>
</blockquote>
</div>
<br class="">
</div>
</div>
</div>
</body>
</html>