[petsc-users] PETSc version 3.9 with Fortran and DMPlex questions

Matthew Knepley knepley at gmail.com
Tue Apr 10 15:14:52 CDT 2018


On Tue, Apr 10, 2018 at 2:19 PM, Bernardo Rocha <
bernardomartinsrocha at gmail.com> wrote:

> Hi everyone,
>
> I have two questions.
>
> (Q1)
> The first one is related to the new PETSc 3.9.
> I've been using Fortran and using the "userctx" to wrap some data
> for the function calls within my program.
>
> Just like : call func(...,userctx)
> and retrieving data as:
> PetscFortranAddr userctx(*)
> b = userctx(2)
>
> With the new version I got the following error:
> b = userctx(2)
> Error: Can't convert INTEGER(8) to TYPE(tvec) at (1)
>
> Is there a way to keep using the trick with "userctx", instead of passing
> all the arguments to the functions separately?
>
> (Q2)
> The second is related to DMPlex.
> When I use the CreateBoxMesh with 2x1x1 cells, I get the expected output:
>
> DM Object: 1 MPI processes
>   type: plex
> DM_0x84000000_0 in 3 dimensions:
>   0-cells: 12
>  * 1-cells: 20*
>   *2-cells: 11*
>   3-cells: 2
> Labels:
>   depth: 4 strata with value/size (0 (12), 1 (20), 2 (11), 3 (2))
>
> However, If I try to create that manually to reproduce the same case 2x1x1
> cells (creating this simple element connectivity by hand) using
> DMPlexCreateFromCellList I get the following:
>
> DM Object: DM_0x84000000_0 1 MPI processes
>   type: plex
> DM_0x84000000_0 in 3 dimensions:
>   0-cells: 12
>   *1-cells: 22*
> *  2-cells: 12*
>   3-cells: 2
> Labels:
>   depth: 4 strata with value/size (0 (12), 1 (22), 2 (12), 3 (2))
>
> That is, it seems the shared face between the two cells is counted twice.
> Is that right? What am I missing here?
>

Since the input is cell-vertex, my guess is that the order of the vertices
on a cell is not what I expect.
I have readers for common formats, but FromCellList() is my own. You can
see what vertices I think
constitute the faces:


https://bitbucket.org/petsc/petsc/src/05d412bc580c652749a091cc13ab756bb8816ec1/src/dm/impls/plex/plexinterpolate.c?at=master&fileviewer=file-view-default#plexinterpolate.c-113

Sorry, this was confusing. Most people are using the input formats, mesh
generators, or predefined shapes,
so I do not get a lot of feedback on this interface.

  Thanks,

    Matt


> Best regards,
> Bernardo
>



-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180410/c6a37f88/attachment.html>


More information about the petsc-users mailing list