[petsc-users] PETSc version 3.9 with Fortran and DMPlex questions
Bernardo Rocha
bernardomartinsrocha at gmail.com
Wed Apr 11 08:06:19 CDT 2018
OK Matthew, thanks a lot for your feedback.
Reading the code for the first two faces I noted you used the standard
numbering for the faces.
face 0 (bottom) -> nodes 0 1 2 3
face 1 (top) -> nodes 4 5 6 7
When this is defined, all the other faces are fixed.
Therefore, I noticed some indexes errors in the code:
//facesTmp[8] = cone[0]; facesTmp[9] = cone[3]; facesTmp[10] =
cone[5]; facesTmp[11] = cone[4]; /* Front */
//facesTmp[12] = cone[2]; facesTmp[13] = cone[1]; facesTmp[14] =
cone[7]; facesTmp[15] = cone[6]; /* Back */
//facesTmp[16] = cone[3]; facesTmp[17] = cone[2]; facesTmp[18] =
cone[6]; facesTmp[19] = cone[5]; /* Right */
//facesTmp[20] = cone[0]; facesTmp[21] = cone[4]; facesTmp[22] =
cone[7]; facesTmp[23] = cone[1]; /* Left */
It should be fixed to (basically swap cone[5] with cone[7]):
facesTmp[8] = cone[0]; facesTmp[9] = cone[3]; facesTmp[10] =
cone[7]; facesTmp[11] = cone[4]; /* Front */
facesTmp[12] = cone[2]; facesTmp[13] = cone[1]; facesTmp[14] =
cone[5]; facesTmp[15] = cone[6]; /* Back */
facesTmp[16] = cone[3]; facesTmp[17] = cone[2]; facesTmp[18] =
cone[6]; facesTmp[19] = cone[7]; /* Right */
facesTmp[20] = cone[0]; facesTmp[21] = cone[4]; facesTmp[22] =
cone[5]; facesTmp[23] = cone[1]; /* Left */
I did it like this, recompiled the code and at least the number of faces
and edge are correct for me now
when using DMPlexCreateFromCellList.
I don't know if this change has some impact in other parts of the code.
I hope not.
Best regards,
Bernardo M. Rocha
On Tue, Apr 10, 2018 at 5:14 PM, Matthew Knepley <knepley at gmail.com> wrote:
> 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/05d412bc580c652749a091cc13ab75
> 6bb8816ec1/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/20180411/f45bc2f9/attachment-0001.html>
More information about the petsc-users
mailing list