Import OpenFOAM mesh to Nektar++
******************* This email originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list https://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address. ******************* Hi All, I am attempting to import an existing OpenFOAM mesh into Nektar++ (I am trying to avoid having to recreate this mesh from scratch). I do this by exporting the mesh from OpenFOAM as a VTK format, and then use gmsh to import the VTK files (There is one file for each boundary plus the volume mesh), and then write the files as a .msh file. Finally, I use NekMesh to read the .msh file and convert to an .xml format with: NekMesh -v -m linkcheck wmc.msh wmcMesh.xml This doesn't return any errors, but it seems that the mesh is not generated properly since the wmcMesh.xml file shows the boundaries as having zero faces: 12 <COMPOSITE> 13 <C ID="1"> F[0] </C> 14 <C ID="2"> F[0] </C> 15 <C ID="3"> F[0] </C> 16 <C ID="4"> F[0] </C> 17 <C ID="5"> F[0] </C> 18 <C ID="6"> F[0] </C> 19 <C ID="7"> F[0] </C> 20 <C ID="8"> H[0-972399] </C> 21 </COMPOSITE> 22 <DOMAIN> C[8] </DOMAIN> 23 </GEOMETRY> 24 <Metadata> 25 <Provenance> 26 <Hostname>str-c37.uncc.edu</Hostname> 27 <NektarVersion>5.2.0</NektarVersion> 28 <Timestamp>26-May-2022 11:51:40</Timestamp> 29 </Provenance> 30 <NekMeshCommandLine>-v -m linkcheck wmc.msh wmcMesh.xml </NekMeshCommandLine> 31 </Metadata> 32 <EXPANSIONS> 33 <E COMPOSITE="C[8]" NUMMODES="4" TYPE="MODIFIED" FIELDS="u,v,w,p" /> 34 </EXPANSIONS> 35 </NEKTAR> However, the log seems to show Nektar++ does recognize the boundary elements: [InputGmsh] Reading Gmsh file: 'wmc.msh' [InputGmsh] Cannot find corresponding element face for 2D element 0 [InputGmsh] This element has 4 vertex [InputGmsh] This element has 4 edges [InputGmsh] Finished reading mesh. [InputGmsh] - Element dimension : 3 [InputGmsh] - Space dimension : 3 [InputGmsh] - No. of nodes : 1014073 [InputGmsh] - No. of 3D elements : 972400 [InputGmsh] - No. of boundary elements : 82536 [InputGmsh] - Elapsed time: 45.646s. [ProcessLinkCheck] Checking boundary-element links. [ProcessLinkCheck] Cannot find corresponding element face for 2D element 0 [ProcessLinkCheck] This element has 4 vertex [ProcessLinkCheck] This element has 4 edges [ProcessLinkCheck] - Elapsed time: 30.1317s. [OutputNekpp] Writing Nektar++ file 'wmcMesh.xml' [OutputNekpp] - Elapsed time: 46.8262s. Any suggestions on how this can be corrected, or how to import the mesh from OpenFOAM? Thanks in advance for any help. *Marc Goldbach* PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte
Hi Mark, I would try defining the boundaries in gmsh again (using add physical group) and then saving the .msh file. That possibly solve the problem Cheers, Mohsen ________________________________ From: nektar-users-bounces@imperial.ac.uk <nektar-users-bounces@imperial.ac.uk> on behalf of Marc Goldbach <mgoldbac@uncc.edu> Sent: Thursday, May 26, 2022 5:32 PM To: nektar-users <nektar-users@imperial.ac.uk> Subject: [Nektar-users] Import OpenFOAM mesh to Nektar++ This email from mgoldbac@uncc.edu originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders list<https://spam.ic.ac.uk/SpamConsole/Senders.aspx> to disable email stamping for this address. Hi All, I am attempting to import an existing OpenFOAM mesh into Nektar++ (I am trying to avoid having to recreate this mesh from scratch). I do this by exporting the mesh from OpenFOAM as a VTK format, and then use gmsh to import the VTK files (There is one file for each boundary plus the volume mesh), and then write the files as a .msh file. Finally, I use NekMesh to read the .msh file and convert to an .xml format with: NekMesh -v -m linkcheck wmc.msh wmcMesh.xml This doesn't return any errors, but it seems that the mesh is not generated properly since the wmcMesh.xml file shows the boundaries as having zero faces: 12 <COMPOSITE> 13 <C ID="1"> F[0] </C> 14 <C ID="2"> F[0] </C> 15 <C ID="3"> F[0] </C> 16 <C ID="4"> F[0] </C> 17 <C ID="5"> F[0] </C> 18 <C ID="6"> F[0] </C> 19 <C ID="7"> F[0] </C> 20 <C ID="8"> H[0-972399] </C> 21 </COMPOSITE> 22 <DOMAIN> C[8] </DOMAIN> 23 </GEOMETRY> 24 <Metadata> 25 <Provenance> 26 <Hostname>str-c37.uncc.edu<http://str-c37.uncc.edu></Hostname> 27 <NektarVersion>5.2.0</NektarVersion> 28 <Timestamp>26-May-2022 11:51:40</Timestamp> 29 </Provenance> 30 <NekMeshCommandLine>-v -m linkcheck wmc.msh wmcMesh.xml </NekMeshCommandLine> 31 </Metadata> 32 <EXPANSIONS> 33 <E COMPOSITE="C[8]" NUMMODES="4" TYPE="MODIFIED" FIELDS="u,v,w,p" /> 34 </EXPANSIONS> 35 </NEKTAR> However, the log seems to show Nektar++ does recognize the boundary elements: [InputGmsh] Reading Gmsh file: 'wmc.msh' [InputGmsh] Cannot find corresponding element face for 2D element 0 [InputGmsh] This element has 4 vertex [InputGmsh] This element has 4 edges [InputGmsh] Finished reading mesh. [InputGmsh] - Element dimension : 3 [InputGmsh] - Space dimension : 3 [InputGmsh] - No. of nodes : 1014073 [InputGmsh] - No. of 3D elements : 972400 [InputGmsh] - No. of boundary elements : 82536 [InputGmsh] - Elapsed time: 45.646s. [ProcessLinkCheck] Checking boundary-element links. [ProcessLinkCheck] Cannot find corresponding element face for 2D element 0 [ProcessLinkCheck] This element has 4 vertex [ProcessLinkCheck] This element has 4 edges [ProcessLinkCheck] - Elapsed time: 30.1317s. [OutputNekpp] Writing Nektar++ file 'wmcMesh.xml' [OutputNekpp] - Elapsed time: 46.8262s. Any suggestions on how this can be corrected, or how to import the mesh from OpenFOAM? Thanks in advance for any help. Marc Goldbach PhD Student, Department of Mechanical Engineering University of North Carolina at Charlotte
participants (2)
- 
                
                Lahooti, Mohsen
- 
                
                Marc Goldbach