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

Matthew Knepley knepley at gmail.com
Thu Mar 17 09:50:47 CDT 2016


On Wed, Mar 16, 2016 at 7:23 AM, gouarin <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
> Fax: (+33) 1 69 15 67 18
>



-- 
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-dev/attachments/20160317/7c2a6315/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ex18.c
Type: text/x-csrc
Size: 975 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160317/7c2a6315/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dm.png
Type: image/png
Size: 4998 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160317/7c2a6315/attachment.png>


More information about the petsc-dev mailing list