<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Feb 24, 2016 at 6:47 AM, Julian Andrej <span dir="ltr"><<a href="mailto:juan@tf.uni-kiel.de" target="_blank">juan@tf.uni-kiel.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
i'm trying to assemble a mass matrix with the PetscFE/DMPlex interface. I found something in the examples of TAO<br>
<br>
<a href="https://bitbucket.org/petsc/petsc/src/da8116b0e8d067e39fd79740a8a864b0fe207998/src/tao/examples/tutorials/ex3.c?at=master&fileviewer=file-view-default" rel="noreferrer" target="_blank">https://bitbucket.org/petsc/petsc/src/da8116b0e8d067e39fd79740a8a864b0fe207998/src/tao/examples/tutorials/ex3.c?at=master&fileviewer=file-view-default</a><br>
<br>
but using the lines<br>
<br>
DMClone(dm, &dm_mass);<br>
DMSetNumFields(dm_mass, 1);<br>
DMPlexCopyCoordinates(dm, dm_mass);<br>
DMGetDS(dm_mass, &prob_mass);<br>
PetscDSSetJacobian(prob_mass, 0, 0, mass_kernel, NULL, NULL, NULL);<br>
PetscDSSetDiscretization(prob_mass, 0, (PetscObject) fe);<br>
DMPlexSNESComputeJacobianFEM(dm_mass, u, M, M, NULL);<br>
DMCreateMatrix(dm_mass, &M);<br>
<br>
leads to errors in DMPlexSNESComputeJacobianFEM (u is a global vector).<br>
<br>
I don't can understand the necessary commands until DMPlexSNESComputeJacobianFEM. What does it do and why is it necessary? (especially why does the naming involve SNES?)<br>
<br>
Is there another/easier/better way to create a mass matrix (the inner product of the function space and the test space)?<br></blockquote><div><br></div><div>1) That example needs updating. First, look at SNES ex12 which is up to date.</div><div><br></div><div>2) I assume you are using 3.6. If you use the development version, you can remove DMPlexCopyCoordinates().</div><div><br></div><div>3) You need to create the matrix BEFORE calling the assembly</div><div><br></div><div>4) Always always always send the entire error messge</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Regards<span class="HOEnZb"><font color="#888888"><br>
Julian Andrej<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">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></div>