<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>