exo2nek

Nek5000 provides the Exodus mesh conversion tool, exo2nek. This tool converts Exodus meshes (.exo files) into Nek meshes (.re2 files). The source code is located in nek5000/tools, and it can be compiled from that directory with ./maketools exo2nek. In addition to the compilers necessary to use Nek5000, exo2nek requires cmake. See Before You Begin for more information on dependencies. Once it is compilied, the executable will be available in nek5000/bin.

When running this tool, the input steps are as follows:

  • It will first ask you for the number of fluid .exo files, this allows you merge multiple .exo files into one mesh.
  • Then you input .exo file name (without extension) accordingly.
  • It will then ask for the number of solid .exo files for a conjugate heat transfer mesh. If you do not have solid mesh, then just input 0.
  • The tool then starts converting the mesh and prints out some basic information, such as the min and max dimensions, number of elements, and the sideSet IDs.
  • Next, it will ask for the number of periodic boundary pairs (see Periodic Boundaries below). If you have none, simply enter 0.
  • Finally it will ask for the name of the output file. The .re2 extension is implied and should not be included.

An example is shown below with the expected user input highlighted.

 please input number of fluid exo files:
1
 please input exo file:
inlet

inlet.exo                        is an EXODUSII file; version 0.00
I/O word size 8

database parameters:

title         =  Created by ICEMCFD - EXODUS II Interface

num_dim       =        3
num_nodes     =    35901
num_elem      =   165590
num_elem_blk  =        1
num_side_sets =        3

element block id   =        1
element type       =    TETRA
num_elem_in_block  =   165590
num_nodes_per_elem =        4

 TETRA4 is valid element in a 3D mesh.
 assume linear hybrid mesh (tetra-hex-wedge)
 one TETRA4 divide into 4 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


Store SideSet information from EXO file
Sideset  2 ...
Sideset  3 ...
Sideset  4 ...

Converting elements ...
 flag1
 flag2
 Converting elements in block            1
 nvert,                     4
 Converted elements in nek:               662360
Done :: Converting elements
 Domain max xyz:   1.8650400000000000        1.6151700000000000       0.25000000000000000
 Domain min xyz:  -1.8650400000000000       -1.6151700000000002       -4.7500000000000000
 total element now is                662360
 fluid exo file            1  has elements       662360
 calling: gather_bc_info()
 done: gather_bc_info()
 ******************************************************
 Boundary info summary
 sideSet ID
           2
           3
           4
 ******************************************************
 Enter number of periodic boundary surface pairs:
0
 please give re2 file name:
inlet

writing inlet.re2
 velocity boundary faces:        95148

When using a converted Exodus mesh, the user must set up boundary condition in the .usr file in either the usrdat or usrdat2 subroutines, e.g.

do iel=1,nelv
do ifc=1,2*ndim
  id_face = BoundaryID(ifc,iel)
  if (id_face.eq.1) then        ! surface 1 for inlet
     cbc(ifc,iel,1) = 'v  '
  else if (id_face.eq.2) then    ! surface 2 for outlet
     cbc(ifc,iel,1) = 'O  '
  else if (id_face.eq.3) then    ! surface 3 for wall
     cbc(ifc,iel,1) = 'W  '
  endif
enddo
enddo

or

call setbc(1,1,'v  ') ! set bcID 1 to inlet for field 1 (velocity)
call setbc(2,1,'O  ') ! set bcID 2 to outlet for field 1 (velocity)
call setbc(3,1,'W  ') ! set bcID 3 to wall for field 1 (velocity)

Periodic Boundaries

Periodic boundaries in Nek5000 are implemented on a mesh connectivity level. They must have a conformal element face distribution with a consistent offset vector. Only translational periodicity is supported in exo2nek.

Example:The example below describes the expected inputs for a mesh with a single pair of periodic boundaries.

First, the user must provide the number of periodic surface pairs. In this case, we have 1.

Enter number of periodic boundary surface pairs
1

Next the user specifies which surface IDs are periodic. Here, we set the inlet (sideset 1) to be periodic with the outlet (sideset 2).

input surface 1 and  surface 2  sideSet ID
1 2

The sideset 1 element faces will be mapped to sideset 2 element faces accordingly. However, this requires that you have conformal meshes on sidesets 1 and 2. The P boundary tag will be assigned to the cbc array, while the sideset ID number is still avaialble in the BoundaryID array.

Note

Mulitple pairs of periodic boundaries are supported

Automatic Tet-2-Hex

As Nek5000 supports only hexahedral elements, exo2nek includes a feature that automatically converts tetrahedral and prism meshes to pure hexahedral meshes. All tetrahedral elements are converted to 4 hexahedral elements and all wedge elements are converted to 3 hexahedral elements. These conversions are supported for both 1st and 2nd order elements.

  • TET4 + WEDGE6 –> HEX8
  • TET10 + WEDGE15 –> HEX20

Conjugate Heat Transfer Meshes

Coming soon