owls icon indicating copy to clipboard operation
owls copied to clipboard

io.import_foam_mesh

Open fbob opened this issue 9 years ago • 2 comments

I would like to use io.import_foam_mesh to read the tutorial mesh with io.import_foam_mesh('./buoyantCavity') but got the following issue:

TypeError                                 Traceback (most recent call last)
<ipython-input-28-6999881f8411> in <module>()
----> 1 mesh = ow.io.import_foam_mesh('./buoyantCavity.old/')

/home/beaubert/.local/lib/python2.7/site-packages/Owls-0.0.0-py2.7.egg/Owls/io.pyc in import_foam_mesh(path, exclude)
    271             search="constant\/polyMesh",
    272             files=['faces', 'points', 'owner', 'neighbour'],
--> 273             exclude = exclude,
    274         )
    275     if not fileList:

/home/beaubert/.local/lib/python2.7/site-packages/Owls-0.0.0-py2.7.egg/Owls/io.pyc in find_datafiles(path, files, search, exclude)
     77             list of found files
     78     """
---> 79     data_folders = find_datafolders(search, path, exclude)
     80     return OrderedDict(
     81         [(time, _get_datafiles_from_dir(time, files))

/home/beaubert/.local/lib/python2.7/site-packages/Owls-0.0.0-py2.7.egg/Owls/io.pyc in find_datafolders(regex, path, exclude)
     92     folders = []
     93     for fold, dirs, _ in os.walk(search_folder):
---> 94         dirs[:] = [d for d in dirs for ex in exclude if not re.match(ex, d)]
     95         if re.match(complete_regex, fold):
     96             folders.append(fold)

TypeError: 'NoneType' object is not iterable

fbob avatar Oct 15 '15 21:10 fbob

The commits 7b86e9b and 12f3523 should fix the error msg. At the moment import_foam_mesh just reads the 'faces', 'points', 'owner', 'neighbour' files and returns a DataFrame. Next step should be a function that generates 'cellCentres' from that DataFrame.

greole avatar Oct 22 '15 06:10 greole

Commits 9c6bcbb46eab31552a022ffdc96684e48ce050c3 and 2f1623658a6aea719575cdab947b5f1abdf9bedd introduces Owls.mesh.Mesh you can create an Mesh object and compute face and cell centres. That already allows us to filter eulerian fields by spatial criteria. However so far this is only experimental and results for tetrahedra or skewed meshes are not correct atm. Next step will be sample lines and then parallel processing.

greole avatar Oct 30 '15 07:10 greole