kip-hart / MicroStructPy

Microstructure modeling, mesh generation, analysis, and visualization.
https://docs.microstructpy.org
MIT License
68 stars 19 forks source link

error in exporting mesh to abaqus file format #93

Closed WeilinDeng closed 7 months ago

WeilinDeng commented 8 months ago

Describe the bug There is an error when saving the generated trimesh as abaqus file. The error is:

File "C:\Users\XXX\Desktop\foam.py", line 89, in main tmesh.write('foam_mesh.inp', format='abaqus') File "C:\Users\XXX\Anaconda3\envs\microstrucutpy\Lib\site-packages\microstructpy\meshing\trimesh.py", line 377, in write poly_neighbors = np.array(polymesh.facet_neighbors) AttributeError: 'NoneType' object has no attribute 'facet_neighbors'

To Reproduce Steps to reproduce the behavior:

  1. run "microstructpy --demo=foam.py", which is error free
  2. modify the "foam.py" file by adding a line "tmesh.write('foam_mesh.inp', format='abaqus')" before the definition "def pick_edge(void_tess)"
  3. run "microstructpy --demo=foam.py" again
  4. See error above

version microstructpy 1.5.9

kip-hart commented 7 months ago

Hi @WeilinDeng thank you for the bug report. It is very well written. Please try the following line instead:

tmesh.write('foam.inp', format='abaqus', seeds=seeds, polymesh=pmesh)

The abaqus file writer expects additional information to generate the mesh file. For example, it creates an *NSET for the boundaries and that info is kept in the PolyMesh.

Let me know if that fixes your issue. It generates a inp file on my computer.

kip-hart commented 7 months ago

Hi @WeilinDeng I'm closing this ticket for now but please reach out if you have any other issues.