Hello:
I found that in the same model, given the position of a point, the OpenMC (Version: 0.14.1 dev) using the libmesh library is inconsistent with the tetrahedral mesh located by the OpenMC (Version: 0.12.1 dev) of the moab library, resulting in an error in the libmesh localization mesh.
- Mesh model
Created by abaqus and divided into a first-order tetrahedral mesh, exported the file named unmesh.inp, the model is imported into Cubit as shown in the following fig.1:
Fig.1
2.Get bin at a given position in space
2.1 Libmesh-OpenMC
Import the unmesh.inp generated by abaqus into cubit, then export it as a .exo file named unmesh.exo and read it using openmc(Version: 0.14.1-dev) linked to the libmesh library.
Set a point (0,0,4.5) in the libmesh related code of mesh.cpp, and use get_bin(), connectivity(), vertex(), centroid() and other functions to output the mesh information where the point is located, as shown in Fig.2. The result shows that this point is located in the element number 107, and the coordinates of the four vertices of the element are:
vertex 1: (-0.987657, 1.44405, 2.78425);
vertex 2: (0, 0, 0);
vertex 3: (1.67608, 1.27475, 2.07157);
vertex 4: (-6.3344e-07, 0, 5);
centroid coordinates: (0.172105, 0.679701, 2.46396).
and the output results are shown in Fig.3.
Fig.2
Fig.3
2.2 Moab-OpenMC
Import the unmesh.inp generated by abaqus into cubit, save it as a cub file, and then use mbcovert plug-in to convert it to a file named unmesh.h5m. Read using openmc(Version: 0.12.1-dev) linked to the moab library.
Also set a point (0,0,4.5) in mesh.cpp, and use the get_bin() and centroid() functions of the moab library to get the mesh number and centroid coordinates, as shown in Fig.4. Since OpenMC (Version: 0.12.1-dev) does not have a function to output tetrahedral vertices directly. By modifying the compute_barycentric_data() function, all tetrahedral vertices and centroid information are output to the barycentric.txt file, as shown in Fig.5. According to the output results, this point is located in the element numbered 24, and the elelment vertex coordinates are respectively:
vertex 1: (1.67608, 1.27475, 2.07157);
vertex 2: (0, 0, 0);
vertex 3: (1.48608, 1.30312, 2.61116);
vertex 4: (-6.3344e-07, 0, 5);
centroid coordinates: (0.79054, -0.00709152, 2.42068).
The output is shown in Figure 6,7. The results are not consistent with libmesh. The element obtained by the libmesh library in 2.1 corresponds to the element 11 of the moab library.
Fig.4
Fig.5
Fig.6
Fig.7
3.Verification
Write a C++ program to determine whether a point is in a tetrahedral body. The program defines a function,which takes four vertices of a tetrahedron and a point to be measured as parameters, and returns a Boolean value indicating whether the point is in the tetrahedron.
By verification, the point (0, 0, 4.5) is in the element obtained by the MOAB library and not in the element obtained by the libmesh library.