Hello<br><br>I am attempting to implement a &quot;hack&quot; that was posted on the list a while back. I&#39;m working with the adjoint linear system solver for a CFD solver. I&#39;m using the ASM (or Block Jacobi) preconditioner with ILU(p) on each of the sub-domains. I use a different Preconditioner matrix (Pmat) than the actual jacobian. What I want to do is destroy the Pmat memory after the ILU factorization is performed. The hack that was posted is copied below:<br>
<pre><i> PCASMFreeSpace(PC pc)<br></i><i>   {<br></i><i>  PC_ASM         *osm = (PC_ASM*)pc-&gt;data;<br></i><i>  PetscErrorCode ierr;<br></i><i> <br></i><i>     if (osm-&gt;pmat) {<br></i><i>    if (osm-&gt;n_local_true &gt; 0) {<br>
</i><i>      ierr = MatDestroyMatrices(osm-&gt;n_local_true,&amp;osm-&gt;pmat);CHKERRQ(ierr);<br></i><i>    }<br></i><i>  osm-&gt;pmat = 0;<br></i><i>  }<br></i><i>  if (pc-&gt;pmat) {ierr = MatDestroy(pc-&gt;pmat);CHKERRQ(ierr); pc-&gt;pmat = 0;}<br>
</i><i>  return 0;<br></i><i> }<br></i></pre><br>However, I&#39;ve had no luck actually getting the function compiled into petsc. There are no erorrs reported with i type &quot;make&quot; in the asm directory, but when I try to use the function in my application it can&#39;t find the symbol while linking. Where does it go in the asm.c file? Does it use &quot;static PetscErrorCode&quot; or &quot;PetscErrorCode PETSCKSP_DLLEXPORT&quot;? Does it have to be added to the .h include files? What has to be done for it work with Fortran? <br>
<br>Any suggestions would be greatly appreciated.  This represents a significant chunk of my application&#39;s memory (10%-30%) and as such its too much to ignore.  
Also is there any chance something like this would make it into an actual PETSc release? <br><br>Gaetan<br><br>