[petsc-dev] Problem in viewer for surface for 3D problem

gouarin loic.gouarin at math.u-psud.fr
Thu Mar 17 11:26:02 CDT 2016


Thanks Matt and sorry for my mistake !!!!

Le 17/03/2016 15:50, Matthew Knepley a écrit :
> On Wed, Mar 16, 2016 at 7:23 AM, gouarin <loic.gouarin at math.u-psud.fr
> <mailto:loic.gouarin at math.u-psud.fr>> wrote:
>
>     Hi,
>
>     I try to use PETSc to solve BEM problem so I need to construct a
>     surface with 3D coordinates. First of all, I would like to plot the
>     mesh and I think that the output of the viewer is completely wrong.
>
>     Here is a Python example
>
>     import sys, petsc4py
>     petsc4py.init(sys.argv)
>     import numpy as np
>     import petsc4py.PETSc as petsc
>
>
>     coords = np.array([[0, 0, 0],
>                         [1, 0, 0],
>                         [0, 1, 0],
>                         [1, 1, 0],
>                         [0, 0, 1],
>                         [1, 0, 1],
>                         [0, 1, 1],
>                         [1, 1, 1],
>                        ], dtype=np.double)
>
>     cells = np.array([[0, 1, 3, 2],
>                        [1, 5, 7, 3],
>                        [0, 4, 6, 2],
>                        [2, 3, 6, 7],
>
>
> This quad is mis-specified, since 3-6 is a diagonal.
>
>                        [0, 1, 5, 4],
>                        [4, 5, 7, 6],
>                       ], dtype=np.int32)
>
>     dm = petsc.DMPlex().createFromCellList(2, cells, coords,
>     interpolate=False, comm=petsc.COMM_WORLD)
>
>     viewer = petsc.Viewer().createHDF5('cube.h5', 'w')
>     dm.view(viewer)
>
>     If you look at the cells in the cube.h5, the numbering of the points
>     is wrong.
>
>
> I rewrote this in C, and I can visualize the surface. I then run it using
>
>    ./ex18 -dm_view hdf5:dm.h5
>
> and process that file
>
>    ./bin/petsc_gen_xdmf.py dm.h5
>
> This won't quite work when you have interpolate = PETSC_FALSE, because
> then I do not force the 'viz' output,
> however it can be forced with a viewer format.
>
>    Thanks,
>
>      Matt
>
>     Thanks,
>     Loic
>     --
>     Loic Gouarin
>     Laboratoire de Mathématiques
>     Université Paris-Sud
>     Bâtiment 425
>     91405 Orsay Cedex
>     France
>     Tel: (+33) 1 69 15 60 14 <tel:%28%2B33%29%201%2069%2015%2060%2014>
>     Fax: (+33) 1 69 15 67 18 <tel:%28%2B33%29%201%2069%2015%2067%2018>
>
>
>
>
> --
> 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

-- 
Loic Gouarin
Laboratoire de Mathématiques
Université Paris-Sud
Bâtiment 425
91405 Orsay Cedex
France
Tel: (+33) 1 69 15 60 14
Fax: (+33) 1 69 15 67 18



More information about the petsc-dev mailing list