[petsc-users] matsetvaluesblocked4_

Jed Brown jed at jedbrown.org
Wed May 27 18:38:48 CDT 2020


Mark Adams <mfadams at lbl.gov> writes:

>>
>>
>>> I think I may know what your problem is. Plex evaluates the blocksize by
>> looking for an equal number of dofs
>> on each point. This is sufficient, but not necessary. If you are using
>> higher order methods, there is block structure
>> there that I will not see.
>>
>
> I don't understand what the order has to do with it.
>
> I use code like this to setup the dofs:
>
>  for (ii=0;ii<ctx->num_species;ii++) {
>     ierr = PetscFECreateDefault(PetscObjectComm((PetscObject) dm), dim, 1,
> ctx->simplex, NULL, PETSC_DECIDE, &ctx->fe[ii]);CHKERRQ(ierr);
>     ierr = DMSetField(dm, ii, NULL, (PetscObject)
> ctx->fe[ii]);CHKERRQ(ierr);
>   }
>
> Everything is constant, elements (eg, Q3) and dofs/vertex.

Everything in DMPlex is by *point*.  A vertex has one block (num_species
above), but a Q2 edge has two, a Q2 face has 4, and a Q2 cell has 8.

Note that some DMPlex stuff might run faster if you just make one field
with num_species components instead of num_species fields with one
component each.  It'll also make the block structure more exploitable.


More information about the petsc-users mailing list