ExtremeFLOW / neko

/ᐠ. 。.ᐟ\ᵐᵉᵒʷˎˊ˗
https://neko.cfd/
Other
173 stars 31 forks source link

.nmsh files and images #936

Open jacobsorme opened 1 year ago

jacobsorme commented 1 year ago

Hi,

Would it be possible to add some output images to the README of examples, or to the general README? Also, could some instructions on how to open and use .nmsh files be added?

Kind regards

timofeymukha commented 1 year ago

Documenting .nmsh is definitely something that we must do. Same for expanding the examples Readme, perhaps including an image with expected output. I think it is hard for us to promise when it will be done due to manpower limits. But your input is nevertheless very much appreciated since it helps us set priorities in our efforts.

jacobsorme commented 1 year ago

I understand. Let me know if you need any help in that.

njansson commented 1 year ago

Any help is of course more than welcome!

Regarding the .nmsh file, this is Neko's binary mesh file; it does not contain any solutions or such (for this, we use Nek5000's field format), only a collection of elements and zones (for marking boundary conditions and such). The format itself is relatively simple, starting with a small header of two integers, the numbers of elements nelv and the geometrical dimension gdim. Then follows a list of nelv elements, quads in 2d and hexes in 3d, the format for those are descrined here: https://github.com/ExtremeFLOW/neko/blob/develop/src/io/format/nmsh.f90. Following the elements comes the zones and finally deformation information, the entire reader can be found here: https://github.com/ExtremeFLOW/neko/blob/develop/src/io/nmsh_file.f90 (Indeed a description like this should for sure be in the documentation's appendix)

The current meshing workflow is to generate a mesh in gmsh, convert it into Nek5000's rea/re2, and finally run the rea2nbin tool to generate the final .nmsh file. There's no plugin for VisIT/Paraview or such to load .nmsh files, so the only way to "debug" a mesh is to write out a field file from the solver.

timfelle commented 1 year ago

I guess this is as good as any place to get this clarified, if not let me know and ill make a separate issue.

I have attempted to follow the recommended workflow here, however, I am not that used to setting up these types of models so I might have missed something.

Additionally I am not certain what is meant with the warning "No NEKTON map found".

Cubit Journal Script ``` reset #{ pipe_length = 100 } #{ pipe_width = 20 } #{ element_size = 5 } brick x {pipe_length} y {pipe_width} z {element_size} move all location {pipe_length / 2} {pipe_width / 2} {element_size / 2} include_merged curve with length={pipe_length} interval {pipe_length / element_size} curve with length={pipe_width} interval {pipe_width / element_size} curve with length={element_size} interval 1 # curve with length 20 scheme dualbias factor 1 1 surface scheme map mesh surface all volume scheme map mesh volume all # Setup the blocks and sides of the domain block 1 add volume 1 block 1 name "Domain" sideset 1 add surface with x_coord=0 sideset 1 name "inlet" sideset 2 add surface with x_coord={pipe_length} sideset 2 name "outlet" sideset 3 add surface with x_coord={pipe_length / 2} and y_coord={pipe_width} sideset 3 name "wall top" sideset 4 add surface with x_coord={pipe_length / 2} and y_coord=0 sideset 4 name "wall bottom" sideset 5 add surface with x_coord={pipe_length / 2} and z_coord={element_size} sideset 5 name "periodic back" sideset 6 add surface with x_coord={pipe_length / 2} and z_coord=0 sideset 6 name "periodic front" # Define boundary conditions create cfd_bc velocityinlet on sideset 1 create cfd_bc outflow on sideset 2 create cfd_bc wall on sideset 3 create cfd_bc wall on sideset 4 create cfd_bc periodic on sideset 5 create cfd_bc periodic on sideset 6 set exodus netcdf4 off set large exodus file on export mesh "test_pipe.exo" overwrite ```
exo2nek terminal output ``` please input number of fluid exo files: 1 please input exo file: test_pipe test_pipe.exo is an EXODUSII file; version 0.00 I/O word size 8 database parameters: title = cubit(test_pipe.exo): 10/26/2023: 10:59:22 num_dim = 3 num_nodes = 210 num_elem = 80 num_elem_blk = 1 num_side_sets = 6 element block id = 1 element type = HEX8 num_elem_in_block = 80 num_nodes_per_elem = 8 HEX8 is valid element in a 3D mesh. assume linear hybrid mesh (tetra-hex-wedge) one HEX8 divide into 8 Nek hex elements please input number of solid exo files for CHT problem (input 0 for no solid mesh): 0 done pre-read exo files now converting to nek mesh Doing linear tet2hex conversion for hybrid (tet4+wedge6+hex8) mesh Store SideSet information from EXO file Sideset 1 ... Sideset 2 ... Sideset 3 ... Sideset 4 ... Sideset 5 ... Sideset 6 ... Converting elements ... Converting elements in block 1 nvert, 8 Converted elements in nek: 640 Done :: Converting elements Domain max xyz: 100.00000000000000 20.000000000000000 5.0000000000000000 Domain min xyz: 0.0000000000000000 0.0000000000000000 0.0000000000000000 total element now is 640 fluid exo file 1 has elements 640 performing non-right-hand check calling: gather_bc_info() done: gather_bc_info() ****************************************************** Boundary info summary sideSet ID 1 2 3 4 5 6 ****************************************************** For Fluid domain Enter number of periodic boundary surface pairs: 1 input surface 1 and surface 2 sideSet ID 5 6 translation vector: 0.0000000000000000 0.0000000000000000 -5.0000000000000000 offset and normalize periodic face coordinates bucket sorting to make index of each point doing periodic check for surface 5 doing periodic check for surface 6 ****************************************************** Please set boundary conditions to all non-periodic boundaries in .usr file usrdat2() subroutine ****************************************************** please give re2 file name: test_pipe writing test_pipe.re2 velocity boundary faces: 832 ```
rea2nbin terminal output ``` $> rea2nbin test_pipe.re2 test_pipe.nmsh _ __ ____ __ __ ____ / |/ / / __/ / //_/ / __ \ / / / _/ / ,< / /_/ / /_/|_/ /___/ /_/|_| \____/ (version: 0.6.99) (build: 2023-10-26 on x86_64-pc-linux-gnu using gnu) Reading binary NEKTON file test_pipe.re2 gdim = 0, nelements = 6403 *** WARNING: No NEKTON map file found *** *** ERROR: Invalid dimension *** ERROR STOP Error termination. Backtrace: #0 0x7fb81b632960 in ??? #1 0x7fb81b6334d9 in ??? #2 0x7fb81b634b47 in ??? #3 0x56235b11e3c3 in __utils_MOD_neko_error_msg at common/utils.f90:146 #4 0x56235b12cc02 in mesh_init_common at mesh/mesh.f90:263 #5 0x56235b148eec in __re2_file_MOD_re2_file_read at io/re2_file.f90:138 #6 0x56235b132cf8 in __file_MOD_file_read at io/file.f90:143 #7 0x56235b11e104 in rea2nbin at /neko/contrib/rea2nbin/rea2nbin.f90:38 #8 0x56235b119ade in main at /neko/contrib/rea2nbin/rea2nbin.f90:2 ```
timofeymukha commented 1 year ago

I had similar issues with the gmsh2nek -> rea2nbin. The issue in the end was with gmsh2nek, and using a tweaked version of that sovled the issue. My impression is that the *2nek tools are not very reliable.

timfelle commented 1 year ago

I think i have resolved the Issue i faced. Nek5000 have in april 2023 introduced a V004 of their re2 files. This mean the header have changed and the current specification in re2_file, line 99 is outdated. They have added an additional integer variable stored in the header which they call nBCre2 and updated the length of the integers.

Old format: '(a5,i9,i3,i9,a54)'

New Format: '(a5,i16,i3,i16,i4,a36)'

timfelle commented 1 year ago

Question is whether they also changed the general packing algorithm..

Edit: They did not. Side note: the new Nek5000 ".re2" Version 004 is now supported as of #1015