<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 20, 2016 at 9:42 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">Thanks for the suggestion. I guess DMCreateSubDM can work, but is<br>
cumbersome to handle for the normal solution process since the mass<br>
matrix for example is not a seperate field.<br></blockquote><div><br></div><div>I did not understand what you meant by "parts of the physics". If you just</div><div>want to make a different operator, then swap out the PetscDS from the DM.</div><div>That holds the pointwise functions and discretizations.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
src/snes/examples/tutorials/<wbr>ex77 handles a seperate field for the<br>
nullspace, if anyone is interested in that.<br>
<br>
An intuitive way was just copying the DM and describing a new problem on it.<br>
<br>
  DM dm_mass;<br>
  PetscDS ds_mass;<br>
  Vec dummy;<br>
  PetscInt id = 1;<br>
  petsc_call(<wbr>DMCreateGlobalVector(dm, &dummy));<br>
  petsc_call(DMClone(ctx->dm, &dm_mass));<br>
  petsc_call(DMGetDS(dm_mass, &ds_mass));<br>
  petsc_call(<wbr>PetscDSSetDiscretization(ds_<wbr>mass, 0, (PetscObject)fe));<br>
  petsc_call(PetscDSSetJacobian(<wbr>ds_mass, 0, 0, mass_kernel, NULL, NULL, NULL));<br>
  petsc_call(PetscDSAddBoundary(<wbr>ds_mass, PETSC_TRUE, "wall", "marker",<br>
0, 0, NULL, (void (*)())ctx->exact_funcs[0], 1, &id, ctx));<br>
  petsc_call(DMCreateMatrix(dm_<wbr>mass, &ctx->M));<br>
  petsc_call(<wbr>DMPlexSNESComputeJacobianFEM(<wbr>dm_mass, dummy, ctx->M,<br>
ctx->M, NULL));<br>
<br>
is this an intended way to assemble a jacobian based on a weak form?<br>
The memory overhead for a DM copy isn't huge on the first sight.<br></blockquote><div><br></div><div>Its O(1).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And a much more important question. Is there any mathematical<br>
description how exactly you handle dirichlet boundary conditions here?<br></blockquote><div><br></div><div>Right now, you can do two things:</div><div><br></div><div>  1) Handle it yourself</div><div><br></div><div>or</div><div><br></div><div>  2) eliminate particular dofs</div><div><br></div><div>If you use 2), these dofs are eliminated from the global vector. They remain in the</div><div>local vector, and boundary values are inserted before local vectors are passed to</div><div>assembly routines.</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">
On first sight it looks like condensing the nodes only to<br>
non-essential nodes and then projecting them back in the solution<br>
vector. If thats teh case I don't understand how you "augment" the<br>
solution with the boundary nodes.<br>
<br>
Regards<br>
<span class="HOEnZb"><font color="#888888">Julian<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Oct 19, 2016 at 11:51 AM, Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br>
> On Tue, Oct 18, 2016 at 7:38 AM, Julian Andrej <<a href="mailto:juan@tf.uni-kiel.de">juan@tf.uni-kiel.de</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> i have general question about PetscFE. When i want to assemble certain<br>
>> parts of physics separately, how can i do that? I basically want to<br>
>> assemble matrices/vectors from the weak forms on the same DM (and<br>
>> avoid copying the DM) and use them afterwards. Is there a convenient<br>
>> way for doing that?<br>
>><br>
>> The "workflow" i'm approaching is something like:<br>
>><br>
>> - Setup the DM<br>
>> - Setup discretization (spaces and quadrature) for each weak form i<br>
>> want to compute<br>
>> - Compute just the weak form i want right now for a specific<br>
>> discretization and field.<br>
>><br>
>> The reason is i need certain parts of the "complete" Jacobian for<br>
>> computations of eigenproblems and like to avoid computing those more<br>
>> often than needed.<br>
><br>
><br>
> The way I envision this working is to use DMCreateSubDM(). It should extract<br>
> everything correctly for the subset of fields you select. However, I have<br>
> not<br>
> extensively tested, so if something is wrong let me know.<br>
><br>
>   Thanks,<br>
><br>
>      Matt<br>
><br>
>><br>
>> Regards<br>
>> Julian<br>
><br>
><br>
><br>
><br>
> --<br>
> What most experimenters take for granted before they begin their experiments<br>
> is infinitely more interesting than any results to which their experiments<br>
> lead.<br>
> -- Norbert Wiener<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="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>