[petsc-users] import a mesh.

Matthew Knepley knepley at gmail.com
Wed Aug 21 07:32:25 CDT 2013


On Wed, Aug 21, 2013 at 5:25 AM, <obonnefon at paca.inra.fr> wrote:

>  Hello,
>
> Hello,I found my bug: The indices of the points are offseted in the
> function DMPlexCreateFromCellList.
> Using the correct indicices in the  DMPlexSetLabelValue leads to the
> expected behaviour.
>
Yes, here is how I organize point numbers by default:

[ 0                 - numCells):                         Cells
[nC               - nC+numVertices):            Vertices
[nC+nV        - nC+nV+numFaces):         Faces
[nC+nV+nF - nC+nV+nF+numEdges): Edges

The reason I do this is to preserve the representation of cell-vertex
meshes inside of a mesh with faces and edges
added.

   Thanks,

       Matt


> Thanks you.
> Olivier B
>
> Quoting obonnefon at paca.inra.fr:
>
> Hello,
>
> Ok, I did it:
>     ierr =
> DMPlexCreateFromCellList(comm,dim,8,9,3,0,obcells,2,obvertex,dm);CHKERRQ(ierr);
>     for (i=0;i<obNbBound;i++){
>       ierr =DMPlexSetLabelValue(*dm, "marker", obboundary[i],
> 1);CHKERRQ(ierr);
>     }
>
> but, it is not efficient: The degree of freedom are still present in the
> linear system.
> In the source of  DMPlexCreateSquareBoundary, the label is set for the
> edges and for the points.
> Do I have to do something like this ?
> Thanks,
> Olivier B
>
> Quoting Matthew Knepley <knepley at gmail.com>:
>
> On Tue, Aug 20, 2013 at 10:16 AM, Olivier Bonnefon <
> olivier.bonnefon at avignon.inra.fr> wrote:
>
>>  Hello,
>>
>> Thank-you, I'm using DMPlexCreateFromCellList(), and it works except for
>> the boundary conditions.
>> I'm using Dirichlet boundary conditions, and the corresponding degree of
>> freedom are not substituted (like when I use DMPlexCreateBoxMesh).
>> So, I do have missing a step to define the boundary ?
>>
>
> Yes. For the other formats, it translates boundary markers to DMLabels.
> With the CellList you will have to label your boundary.
> If you want it to work exactly as in the example, for every point p on
> your boundary,
>
>   DMPlexSetLabelValue(dm, "marker", p, 1);
>
> You can avoid the string lookup by using
>
>   DMPlexCreateLabel(dm, "marker");
>   DMPlexGetLabel(dm, "marker", &label);
>   DMLabelSetValue(label, p, 1);
>
> Obviously, if you have multiple BC, you can use a label for each condition.
>
>   Thanks,
>
>      Matt
>
>
>>  Olivier B
>>
>>
>> On 08/20/2013 03:08 PM, Matthew Knepley wrote:
>>
>> On Tue, Aug 20, 2013 at 7:50 AM, Olivier Bonnefon <
>> olivier.bonnefon at avignon.inra.fr> wrote:
>>
>>> Hello,
>>>
>>> I have modify the ex12.c example for a like diffusive problem
>>> (FEM+unstructured mesh+SNES).
>>> The next step, is to replace the square mesh by my own mesh.
>>> I want import my mesh from a simple file, and after distributed it with
>>> DMPlexDistribute.
>>> Is it the good way ?
>>> Is it possible to import a mesh in petsc ? I didn't find the answer in
>>> the documentation. Is there an example ?
>>>
>>
>> There are a few formats supported:
>>
>>   1) Cell-vertex: DMPlexCreateFromCellList()
>>
>>   2) Exodus: DMPlexCreateExodus()
>>
>>   3) CGNS: DMPlexCreateCGNS()
>>
>>   Thanks,
>>
>>      Matt
>>
>>
>>> Thanks
>>> Olivier Bonnefon
>>>
>>> --
>>> Olivier Bonnefon
>>> INRA PACA-Avignon, Unité BioSP
>>> Tel: +33 (0)4 32 72 21 58
>>>
>>>
>>
>>
>>
>> --
>> 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
>>
>>
>>
>> --
>> Olivier Bonnefon
>> INRA PACA-Avignon, Unité BioSP
>> Tel: +33 (0)4 32 72 21 58
>>
>>
>
>
> --
> 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
>
>
>
>
>
>
>


-- 
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/20130821/cacd91fb/attachment.html>


More information about the petsc-users mailing list