[petsc-users] DMPlex example with manual grid layout

Matthew Knepley knepley at gmail.com
Mon Oct 28 10:43:51 CDT 2013


On Mon, Oct 28, 2013 at 6:17 AM, Bernhard Reinhardt <
b.reinhardt at physik.uni-muenchen.de> wrote:

> Hi there,
>
> I am trying to familiarize myself with unstructured grids. For this I
> started with the example given in the petsc-manual (mesh of 2 triangles)
> and tried to modify it according to my needs.
>
> However, the example seems to be incomplete. At least I was not able to
> create a matrix without applying a DMPlexSetDimension.
>
> In the end I decided to set up an an example as simple as possible:
> 1D transport of a scalar in a bar with periodic boundaries.
>
> Lets say I have a bar consisting of 3 volumes and 3 faces.
> You could write this down as a vector of length 3 containing the scalar in
> the volumes and a 3x3 matrix containing the transport coefficients on the
> faces.
>
> I have already tried many different ways of setting this up with plex but
> always failed. Attached you find the version that makes most sense to me.
> It gives me vectors of length 3 and a 3x3 matrix. However, the matrix
> contains no writable entries and I think the returned closures are not
> correct.
>
> Is there a simple example with good documentation of the individual steps
> like in the manual which is complete and working?
>

I have modified your example and it is attached. Here are a few points:

1) You ask for the closure of point 4 in your Vec, and get 1.0. This is
correct.

  The closure of 4 is {4, 1, 2}, the cell + its vertices. There are only
values on cells,
  so you get the value on 4, which is 1.0.

2) The default for preallocation is FEM-style topology, namely that
unknowns are connected to other
     unknowns with overlapping support. The support of your unknowns is
only the cell itself, so there
     are no connections by default. I put in a call to
DMPlexSetPreallocationCenterDimension(), which
     is the dimension of intermediate points. In FEM these are cells, but
in FVM they are vertices (or
     faces). I set your topology to FVM, and you should get the
preallocation you want.

  Thanks,

     Matt

Kind regards
>
> Bernhard
>



-- 
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131028/9f7be67d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.F90
Type: application/octet-stream
Size: 5122 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131028/9f7be67d/attachment.obj>


More information about the petsc-users mailing list