Re: [petsc-users] DMPlexBuildFromCellList node ordering for tetrahedral elements

2024-06-25 Thread onur.notonur via petsc-users
In my workflow, I was trying to use multiple mesh sources, and to achieve that, 
I converted them to an HDF5 file along with all other complementary information 
regarding my PDE. This approach seemed beneficial at first, but it's hard to 
manage now. (Also, I didn't know about DMPlexGenerate() :) ) However, thanks to 
you, I see I need to inspect the tetgenerate.cxx file. Thank you very much!

Thanks,
Onur

Sent with Proton Mail secure email.

On Tuesday, June 25th, 2024 at 2:11 PM, Matthew Knepley  
wrote:

> On Tue, Jun 25, 2024 at 4:50 AM onur.notonur via petsc-users 
>  wrote:
>
>> Hi, I'm trying to implement a Tetgen mesh importer for my Petsc/DMPlex-based 
>> solver. I am encountering some issues and suspect they might be due to my 
>> import process. The Tetgen mesh definitions can be found here for reference: 
>> https: //wias-berlin. de/software/tetgen/fformats. htmlI
>> ZjQcmQRYFpfptBannerStart
>> This Message Is From an External Sender
>> This message came from outside your organization.
>>
>> ZjQcmQRYFpfptBannerEnd
>>
>> Hi,
>>
>> I'm trying to implement a Tetgen mesh importer for my Petsc/DMPlex-based 
>> solver. I am encountering some issues and suspect they might be due to my 
>> import process. The Tetgen mesh definitions can be found here for reference: 
>> [https://urldefense.us/v3/__https://wias-berlin.de/software/tetgen/fformats.html*(https:/*urldefense.us/v3/__https:/*wias-berlin.de/software/tetgen/fformats.html__;!!G_uCfscf7eWS!c6srXdHHqgkq5FoeJpfHljLrP0U3UJOmz6A1-jLgkMBEtv8NTqRKgVTgoP_ArdJT5e5kx9lX53ecjbzZ3iu3-eoV4-Qq_g$)__;XS8v!!G_uCfscf7eWS!YhhAyOWDVeQm_MzXouB0hyFqonqeV1Ds-awndO2XWRhhfqTAwYpejwkiZTw0ayB3NhhOZiJ1f6k-BSQdaNhcYww5f6pyCw$
>>  
>>
>> I am building DMPlex using the DMPlexBuildFromCellList function and using 
>> the exact ordering of nodes I get from the Tetgen mesh files (.ele file). 
>> The resulting mesh looks good when I export it to VTK, but I encounter 
>> issues when solving particular PDEs. (I can solve them while using other 
>> importers I write) I suspect there may be orientation errors or something 
>> similar.
>>
>> So, my question is, Is the ordering of nodes in elements important for 
>> tetrahedral elements while using DMPlexBuildFromCellList? If so, how should 
>> I arrange them?
>
> Yes, TetGen inverts tetrahedra compared to Plex, since I use all outward 
> facing normals, whereas those in TetGen are not consistently ordered. 
> However, why not just use DMPlexGenerate() with TetGen?
>
> Thanks,
>
> Matt
>
>> Thanks,
>> Onur
>>
>> Sent with Proton Mail secure email.
>
> --
>
> 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://urldefense.us/v3/__https://www.cse.buffalo.edu/*knepley/*(http:/*www.cse.buffalo.edu/*knepley/)__;fl0vfg!!G_uCfscf7eWS!YhhAyOWDVeQm_MzXouB0hyFqonqeV1Ds-awndO2XWRhhfqTAwYpejwkiZTw0ayB3NhhOZiJ1f6k-BSQdaNhcYwy4tGMtYw$
>  

[petsc-users] DMPlexBuildFromCellList node ordering for tetrahedral elements

2024-06-25 Thread onur.notonur via petsc-users
Hi,

I'm trying to implement a Tetgen mesh importer for my Petsc/DMPlex-based 
solver. I am encountering some issues and suspect they might be due to my 
import process. The Tetgen mesh definitions can be found here for reference: 
https://urldefense.us/v3/__https://wias-berlin.de/software/tetgen/fformats.html__;!!G_uCfscf7eWS!c6srXdHHqgkq5FoeJpfHljLrP0U3UJOmz6A1-jLgkMBEtv8NTqRKgVTgoP_ArdJT5e5kx9lX53ecjbzZ3iu3-eoV4-Qq_g$
 

I am building DMPlex using the DMPlexBuildFromCellList function and using the 
exact ordering of nodes I get from the Tetgen mesh files (.ele file). The 
resulting mesh looks good when I export it to VTK, but I encounter issues when 
solving particular PDEs. (I can solve them while using other importers I write) 
I suspect there may be orientation errors or something similar.

So, my question is, Is the ordering of nodes in elements important for 
tetrahedral elements while using DMPlexBuildFromCellList? If so, how should I 
arrange them?

Thanks,
Onur

Sent with Proton Mail secure email.

[petsc-users] DMPlex "Could not find orientation for quadrilateral"

2023-12-12 Thread onur.notonur via petsc-users
Hi,

I hope this email finds you well. I am currently working on importing an 
OpenFOAM PolyMesh into DMPlex, and I've encountered an issue. The PolyMesh 
format includes face owner cells/neighbor cells and face-to-vertex 
connectivity. I was using the "DMPlexCreateFromCellListPetsc()" function, which 
required cell-to-vertex connectivity. However, when attempting to create the 
cell connectivity using an edge loop [p_0, p_1, ..., p_7] (p_n and p_(n+1) are 
valid edges in my mesh), I encountered an error stating, "Could not find 
orientation for quadrilateral."

(Actually at first, I generated the connectivity list by simply creating a 
cell-to-face list and then using that to create a cell-to-vertex list. (just 
map over the list and remove duplicates) This created a DMPlex successfully, 
however, resulted in a mesh that was incorrect when looking with ParaView. I 
think that was because of I stated wrong edge loop to create cells)

I understand that I may need to follow a different format for connectivity, but 
I'm not sure what that format is. My current mesh is hexahedral, consisting of 
8 corner elements(if important). I would appreciate any guidance on a general 
approach to address this issue.

Thank you for your time and assistance.

Best,
Onur

Sent with Proton Mail secure email.

Re: [petsc-users] Advices on creating DMPlex from custom input format

2023-10-31 Thread onur.notonur via petsc-users
Dear Matt and Jed,

Thank you so much for your insights.

Jed, as far as I know, the format is custom internal structure. I will 
double-check this. If it is used outside, I'm more than willing to contribute 
the reader.

Best,

Onur

Sent with [Proton Mail](https://proton.me/) secure email.

--- Original Message ---
On Monday, October 30th, 2023 at 8:16 PM, Matthew Knepley  
wrote:

> On Mon, Oct 30, 2023 at 5:37 AM onur.notonur via petsc-users 
>  wrote:
>
>> Hi,
>>
>> I hope this message finds you all in good health and high spirits.
>>
>> I wanted to discuss an approach problem input file reading/processing in a 
>> solver which is using PETSc DMPlex. In our team we have a range of solvers, 
>> they are not built on PETSc except this one, but they all share a common 
>> problem input format. This format includes essential data such as node 
>> coordinates, element connectivity, boundary conditions based on elements, 
>> and specific metadata related to the problem. I create an array for boundary 
>> points on each rank and utilize them in our computations, I am doing it 
>> hardcoded currently but I need to start reading those input files, But I am 
>> not sure about the approach.
>>
>> Here's what I have in mind:
>>
>> - - Begin by reading the node coordinates and connectivity on a single core.
>> - Utilize the DMPlexCreateFromCellListPetsc() function to construct the 
>> DMPlex.
>> - Distribute the mesh across processors.
>> - Proceed to read and process the boundary conditions on each processor. If 
>> the global index of the boundary element corresponds to that processor, we 
>> process it; otherwise, we pass.
>>
>> Additionally, maybe I need to reorder the mesh. In that case I think I can 
>> use the point permutation IS obtained from the DMPlexGetOrdering() function 
>> while processing boundary conditions.
>>
>> Also I have another approach in my mind but I don't know if it's possible: 
>> Read/construct DMPlex on single core including boundary conditions. Store BC 
>> related data in Vec or another appropriate data structure. Then distribute 
>> this BC holding data structure too as well as DMPlex.
>
> This is by far the easier approach. If you do not have meshes that are too 
> big to load in serial, I would do
> this. Here is what you do:
>
> - Read in the mesh onto 1 process
> - Mark the boundary conditions, probably with a DMLabel
> - Make a Section over the mesh indicating what data you have for BC
> - Create a Vec from this Section and fill it with boundary values 
> (DMCreateGlobalVector)
> - Distribute the mesh, and keep the point SF (DMPlexDIstribute)
> - Create a BC SF from the points SF (PetscSFCreateSectionSF)
> - DIstribute the BC values using the BC SF (PetscSFBcast)
>
> Thanks,
>
> Matt
>
>> I would greatly appreciate your thoughts and any suggestions you might have 
>> regarding this approach. Looking forward to hearing your insights.
>>
>> Best regards,
>>
>> Onur
>
> --
>
> 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.cse.buffalo.edu/~knepley/)

[petsc-users] Advices on creating DMPlex from custom input format

2023-10-30 Thread onur.notonur via petsc-users
Hi,

I hope this message finds you all in good health and high spirits.

I wanted to discuss an approach problem input file reading/processing in a 
solver which is using PETSc DMPlex. In our team we have a range of solvers, 
they are not built on PETSc except this one, but they all share a common 
problem input format. This format includes essential data such as node 
coordinates, element connectivity, boundary conditions based on elements, and 
specific metadata related to the problem. I create an array for boundary points 
on each rank and utilize them in our computations, I am doing it hardcoded 
currently but I need to start reading those input files, But I am not sure 
about the approach.

Here's what I have in mind:

- - Begin by reading the node coordinates and connectivity on a single core.
- Utilize the DMPlexCreateFromCellListPetsc() function to construct the DMPlex.
- Distribute the mesh across processors.
- Proceed to read and process the boundary conditions on each processor. If the 
global index of the boundary element corresponds to that processor, we process 
it; otherwise, we pass.

Additionally, maybe I need to reorder the mesh. In that case I think I can use 
the point permutation IS obtained from the DMPlexGetOrdering() function while 
processing boundary conditions.

Also I have another approach in my mind but I don't know if it's possible: 
Read/construct DMPlex on single core including boundary conditions. Store BC 
related data in Vec or another appropriate data structure. Then distribute this 
BC holding data structure too as well as DMPlex.

I would greatly appreciate your thoughts and any suggestions you might have 
regarding this approach. Looking forward to hearing your insights.

Best regards,

Onur

[petsc-users] DMPlex edge/vertex orientation

2023-08-04 Thread onur.notonur via petsc-users
Hi,

I'm currently working with 3D DMPlex and performing crucial calculations 
involving face normals and edge tangents. I've noticed that face normals are 
directed from support[0] to support[1]. However, I'm uncertain about the 
conventions for edges and vertices in relation to faces. Specifically, I need 
to determine the order of vertices that create a surface and whether they are 
stored in a counter-clockwise (CCW) or clockwise (CW) manner. As DMPlex follows 
a hierarchy of cell-face-edge-vertex, my main question becomes about the 
orientation of edges. Any clarification on this aspect would be immensely 
helpful!

Additionally, I'm unfamiliar with most of the terms used in DMPlex. For example 
"orientation" in DMPlexGetConeOrientation. If you could suggest some readings 
or resources that explain these concepts, I would greatly appreciate it.

Thx,
Onur

Sent with [Proton Mail](https://proton.me/) secure email.