<div dir="ltr">On Mon, Oct 28, 2013 at 6:17 AM, Bernhard Reinhardt <span dir="ltr"><<a href="mailto:b.reinhardt@physik.uni-muenchen.de" target="_blank">b.reinhardt@physik.uni-muenchen.de</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi there,<br>
<br>
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.<br>
<br>
However, the example seems to be incomplete. At least I was not able to create a matrix without applying a DMPlexSetDimension.<br>
<br>
In the end I decided to set up an an example as simple as possible:<br>
1D transport of a scalar in a bar with periodic boundaries.<br>
<br>
Lets say I have a bar consisting of 3 volumes and 3 faces.<br>
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.<br>
<br>
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.<br>

<br>
Is there a simple example with good documentation of the individual steps like in the manual which is complete and working?<br></blockquote><div><br></div><div>I have modified your example and it is attached. Here are a few points:</div>
<div><br></div><div>1) You ask for the closure of point 4 in your Vec, and get 1.0. This is correct.</div><div><br></div><div>  The closure of 4 is {4, 1, 2}, the cell + its vertices. There are only values on cells,</div>
<div>  so you get the value on 4, which is 1.0.</div><div><br></div><div>2) The default for preallocation is FEM-style topology, namely that unknowns are connected to other</div><div>     unknowns with overlapping support. The support of your unknowns is only the cell itself, so there</div>
<div>     are no connections by default. I put in a call to DMPlexSetPreallocationCenterDimension(), which</div><div>     is the dimension of intermediate points. In FEM these are cells, but in FVM they are vertices (or</div>
<div>     faces). I set your topology to FVM, and you should get the preallocation you want.</div><div><br></div><div>  Thanks,</div><div><br></div><div>     Matt</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Kind regards<span class="HOEnZb"><font color="#888888"><br>
<br>
Bernhard<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>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>