<div><br></div><div><br><div class="gmail_quote"><div dir="ltr">On Tue 21. Apr 2020 at 16:47, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You are overwriting memory somewhere. The prints just move it around. I suggest running with valgrind.<div></div></div></blockquote><div dir="auto"><br></div><div dir="auto">Matt is right. However, judging by the code snippet I bet all the arrays in question are statically allocated, thus valgrind may be of somewhat limited use.</div><div dir="auto"><br></div><div dir="auto">If you send the entire function, or all the related pieces of code, someone in the list might spot the error.</div><div dir="auto"><br></div><div dir="auto">Thanks</div><div dir="auto">Dave</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>  Thanks,</div><div><br></div><div>    Matt</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Apr 21, 2020 at 10:44 AM Kaushik Vijaykumar <<a href="mailto:kaushikv318@gmail.com" target="_blank">kaushikv318@gmail.com</a>> wrote:<br></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">Hello group,<div><br></div><div>I have been trying to navigate a weird error that I have found in my FEA code that I am developing using PetSc. The error occurs when, i execute a call to stiffness generation of a Tetrahederal element. The code returns an memory error if I don't print the following statements in the function, (see the ierr print statements below):</div><div><br></div><div>for (i1=1; i1<4; i1++)  // Loop 6b<br>                               {<br>                                                 for (j1=1; j1<4; j1++) // Loop 7b<br>                                               {<br>                                                          for (k1=1; k1<4; k1++) // Loop 8<br>                                                           {<br>                                                                 for (l1=1; l1<4; l1++) // Loop 9<br>                                                                   {<br>                                                                            s[ii1+i1-1][jj1+j1-1] = s[ii1+i1-1][jj1+j1-1]+C4[i1][k1][j1][l1]*w[k1][l1]*weight;<br>                                                                           ierr = PetscFPrintf(PETSC_COMM_WORLD,outfile,"C4 %f \n",C4[i1][k1][j1][l1]);CHKERRQ(ierr);<br>                                                                         ierr = PetscFPrintf(PETSC_COMM_WORLD,outfile,"w %f \n",w[k1][l1]);CHKERRQ(ierr);<br>                                                                           ierr = PetscFPrintf(PETSC_COMM_WORLD,outfile,"weight %f \n",weight);CHKERRQ(ierr);<br>                                                                  }   // Loop 9<br>                                                                }  // Loop 8<br>                                              } // Loop 7b<br>                      } // Loop 6b<br></div><div><br></div><div><br></div><div>Any help on this is really appreciated.</div><div><br></div><div>Thanks</div><div>Kaushik</div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><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>
</blockquote></div></div>