Inquiry about reading an exodus II file from coreform Cubit by Petsc

Dear coreform users and developers,

I am trying to use Petsc to read an exodus II file from coreform cubit, but without success,
Then I used petsc’s built-in exodus file, /share/petsc/datafiles/meshes/sevenside.exo (which is attached).
This file can be read by petsc successfully.

And I did a test. This file, sevenside.exo, is imported into coreform Cubit, and then is saved as a new exodus file. This new exodus file can not be read by petsc successfully.
Do you have any ideas what is going on here?

ThanKSM

xiaodong
sevenside.exo (3.0 KB)

Hi,

I tried installing petsc4py to see if I could reproduce the problem in a simpler environment. It fails the initialization process. One thing that I will note is the example I found used the Exodus reader directly and not the built-in PETSc one.

Do you have a small C++ example that demonstrates the problem?

Here is a python example using the exodus reader that is distributed with Coreform Cubit. I can read the original and the version written from Coreform Cubit with this code.

#!python

# the python exodus reader is included with Coreform Cubit.
import exodus
import numpy as np

X = 0
Y = 1

with exodus.exodus('~/coreform/sevenside.exo', 'r') as exo_file:

    dim = exo_file.num_dimensions()  # equals 2
    print("Mesh dimension", dim)
    num_blocks = exo_file.num_blks() # there are two blocks one for the quads, one for the tri
    print("Number of block", num_blocks)

    num_nodes = exo_file.num_nodes()
    coords = exo_file.get_coords()

    blocks = exo_file.get_elem_blk_ids() # block ids are 1 and 1001

    # get all element connectivity  in one shot. the connectivity note that this is 1 based
    connectivity = []
    exodus.collectElemConnectivity(exo_file, connectivity)

    # alternatively, get it by block id
    for block in blocks:
        print(f"\nBlock {block} connectivity")
        # The following returns a tuple with array, the length, and the number of nodes per element
        conn = exo_file.get_elem_connectivity(block) 
      
        # print the node coordinates for each block. The connectivity is 1 based by default.
        for e in conn[0]:
            print("Element coord:", coords[X][e-1], coords[Y][e-1])
    print('\n')