Hello Alex,
yes, contributions are welcome!
I am not sure if your code is directly applicable - am I right that it uniformly meshes a rectangle or cube by a regular simplex mesh? But anyway, let us try to find something that would be interesting for you and useful for sfepy. Did you manage to install it without problems?
Cheers, r.
On 03/27/2015 02:10 AM, Alex Eftimiades wrote:
I was working on a discrete exterior calculus framework about a year ago. When it came time to start benchmarking it, I was disappointed with my options for mesh generation. I wanted to test my framework on different geometries, topologies, and dimensions in a consistent way. Since I could not find a good way of doing this, I wrote my own https://github.com/aeftimia/pyfeec/blob/master/pyfeec/grid_utils.pyx in Cython. I apologize for the poor documentation. It turns out I ended up reinventing "Kuhn triangulation" as documented in section 2.2.1 and 2.2.2 in this thesis https://dspace.library.cornell.edu/bitstream/1813/6140/1/92-1322.pdf. I am hoping to get more involved collaborating with open source projects as opposed to working on my own projects. I noticed Sfepy distinctly noted lacking BSD licensed mesh generation code in a 2008 power point http://www.ondrejcertik.com/media/euroscipy2008.pdf but seemed to have made some progress since then as documented here http://sfepy.org/doc-devel/src/sfepy/mesh/mesh_generators.html.
My implementation allows you to specify an arbitrary number of subdivisions along an arbitrary number of axes, and contains two algorithms for generating a corresponding simplicial mesh. Pictures of the result of each algorithm for a 2D discretization are attached. The process looks like this:
- Create a dict that maps tuples of integers (number of "steps" along each axis) to a global index of the corresponding vertex.
shape = [nx, ny, ....] g = grid_indices(shape)
- Connect the vertexes according to one of two algorithms for generating a uniform simplicial mesh (the difference in the resulting meshes is readily seen in the attached pictures). This is stored as an NxD dimensional numpy array of unsigned integers for a mesh with N D-dimensional simplexes. Each integer in the array is the global index of a vertex in the mesh.
simplices = grid(g)
- Customize topology of mesh by stitching pairs of vertexes together. This is accomplished by replacing each occurrence of an index in the above array with the index of the vertex you want to "stitch" it to. So in the case of a one dimensional chain of 10 vertexes, I could create a "ring"-like topology by replacing each occurrence of the integer "9" (the rightmost vertex) with a "0" (the leftmost vertex) in my 9x1 dimensional numpy array of integers (as described in step 2). Since periodic boundary conditions are very common, I wrote a routine specifically for toroidal topologies that are periodic along arbitrary combinations of axes. The routine returns a dict that maps vertex indexes to other vertex indexes such that the key index is to be replaced with the value index. So in this example, it would return {9: 0} to indicate vertex 9 is to be replaced with vertex 0.
stitches = pbc_stitches(g, shape, [0,3]) #imposing periodic boundary conditions along the first and fourth axes.
- I found it most useful to keep the original "unstitched" simplexes too so geometry can be specified separately by embedding the vertexes within a specific coordinate system. For example, I might wish to impose periodic boundary conditions along the second axis in a 3 dimensional system and leave the system in cartesian coordinates. I might alternatively choose to embed the points in a cylindrical coordinate system and have the angular coordinate periodic.
I don't know if you would find this useful. If not, is there anything else I can do to contribute to Sfepy? I read the how to contribute guide http://sfepy.org/doc-devel/developer_guide.html#how-to-contribute, but your development section did say to let you know on your mailing list that I was interested in contributing to Sfepy. I am generally looking to gain experience contributing to open source projects. Since I spend a lot of time writing Python programs that numerically solve PDEs (typically eigenvalue problems at the moment), I thought sfepy might be a good place to start.
Thanks, Alex Eftimiades