[petsc-users] PetscFE questions

Julian Andrej juan at tf.uni-kiel.de
Thu Oct 20 09:42:13 CDT 2016


Thanks for the suggestion. I guess DMCreateSubDM can work, but is
cumbersome to handle for the normal solution process since the mass
matrix for example is not a seperate field.
src/snes/examples/tutorials/ex77 handles a seperate field for the
nullspace, if anyone is interested in that.

An intuitive way was just copying the DM and describing a new problem on it.

  DM dm_mass;
  PetscDS ds_mass;
  Vec dummy;
  PetscInt id = 1;
  petsc_call(DMCreateGlobalVector(dm, &dummy));
  petsc_call(DMClone(ctx->dm, &dm_mass));
  petsc_call(DMGetDS(dm_mass, &ds_mass));
  petsc_call(PetscDSSetDiscretization(ds_mass, 0, (PetscObject)fe));
  petsc_call(PetscDSSetJacobian(ds_mass, 0, 0, mass_kernel, NULL, NULL, NULL));
  petsc_call(PetscDSAddBoundary(ds_mass, PETSC_TRUE, "wall", "marker",
0, 0, NULL, (void (*)())ctx->exact_funcs[0], 1, &id, ctx));
  petsc_call(DMCreateMatrix(dm_mass, &ctx->M));
  petsc_call(DMPlexSNESComputeJacobianFEM(dm_mass, dummy, ctx->M,
ctx->M, NULL));

is this an intended way to assemble a jacobian based on a weak form?
The memory overhead for a DM copy isn't huge on the first sight.

And a much more important question. Is there any mathematical
description how exactly you handle dirichlet boundary conditions here?
On first sight it looks like condensing the nodes only to
non-essential nodes and then projecting them back in the solution
vector. If thats teh case I don't understand how you "augment" the
solution with the boundary nodes.

Regards
Julian


On Wed, Oct 19, 2016 at 11:51 AM, Matthew Knepley <knepley at gmail.com> wrote:
> On Tue, Oct 18, 2016 at 7:38 AM, Julian Andrej <juan at tf.uni-kiel.de> wrote:
>>
>> Hi,
>>
>> i have general question about PetscFE. When i want to assemble certain
>> parts of physics separately, how can i do that? I basically want to
>> assemble matrices/vectors from the weak forms on the same DM (and
>> avoid copying the DM) and use them afterwards. Is there a convenient
>> way for doing that?
>>
>> The "workflow" i'm approaching is something like:
>>
>> - Setup the DM
>> - Setup discretization (spaces and quadrature) for each weak form i
>> want to compute
>> - Compute just the weak form i want right now for a specific
>> discretization and field.
>>
>> The reason is i need certain parts of the "complete" Jacobian for
>> computations of eigenproblems and like to avoid computing those more
>> often than needed.
>
>
> The way I envision this working is to use DMCreateSubDM(). It should extract
> everything correctly for the subset of fields you select. However, I have
> not
> extensively tested, so if something is wrong let me know.
>
>   Thanks,
>
>      Matt
>
>>
>> Regards
>> Julian
>
>
>
>
> --
> What most experimenters take for granted before they begin their experiments
> is infinitely more interesting than any results to which their experiments
> lead.
> -- Norbert Wiener


More information about the petsc-users mailing list