I think that you need to instatiate one of these https://github.com/usnistgov/fipy/blob/develop/fipy/meshes/mesh2D.py#L70
with the correct arrays. For examples, ~~~~ >>> points = [[0,0], [0, 1], [1, 0], [1, 1]] >>> from scipy.spatial import Delaunay >>> tri = Delaunay(points) >>> tri.points array([[ 0., 0.], [ 0., 1.], [ 1., 0.], [ 1., 1.]]) >>> tri.simplices array([[3, 1, 0], [2, 3, 0]], dtype=int32) ~~~~ So the vertices are just the points but reshaped to (2, N) from (N, 2). The face to vertex array would be [[3, 1, 0, 2, 0 [1, 0, 3, 3, 2]] Its all the faces or edges in 2D, and the cell to face ID would be [[0, 3], [1, 2], [2, 4]] Then you can instatiate the Mesh2D object with those three arrrays. Look at https://github.com/usnistgov/fipy/blob/develop/fipy/meshes/mesh2D.py#L269 to see how to do it as well. Notice that the test example has both quads and triangles (the -1 values are masked). On Wed, Jun 15, 2016 at 1:29 PM, James Pringle <jprin...@unh.edu> wrote: > Well, I am motivated to give it a go, since I only have the summer to make > progress on project and it is blocking my research progress right now. Can > you give me a pointer to where the appropriate quantities are defined? I can > certainly write code to make the transformations, but it is a bit hard > without understanding precisely what is defined in the Mesh2D object. I have > made a simple Mesh2D object, but I am not sure which of the attributes, etc, > are absolutely required, or how they are precisely defined. > > Perhaps most useful for me would be > > a definition of which parts of the Mesh2D object must exist > and the format of those parts, in particular the a face to vertex array and > a > cell to face array > > Or you could point me to the appropriate part of the Gmsh code so I can go > from there. I presume poking around in fipy.Gmsh2D would be a good place to > start? Is there a better place to start? > > I would love any documentation on the details of the Mesh2D object. > > Thanks, > Jamie Pringle > University of New Hampshire > > On Wed, Jun 15, 2016 at 12:21 PM, Daniel Wheeler <daniel.wheel...@gmail.com> > wrote: >> >> Hi Jamie, >> >> There is no automated way to make a FiPy mesh from Scipy's Delaunay >> object. The problem is that FiPy needs a face to vertex array and a >> cell to face array while the Delaunay object just has the cell to >> vertex array. The functionality to extract the face to vertex array >> and cell to face array is in FiPy because it must be done for Gmsh, >> however, it is not abstracted in so that it can be reused. >> >> It is certainly possible to make the correct arrays with Numpy and >> pass them to the Mesh2D object, but it's a bit of work to write the >> code. If I find some time I might give it a go, but I don't know when >> I will get to it. >> >> Cheers, >> >> Daniel >> >> On Tue, Jun 14, 2016 at 4:15 PM, James Pringle <jprin...@unh.edu> wrote: >> > Daniel et al. -- >> > >> > As referenced earlier in this thread, I have a complex domain with >> > holes >> > in it; I now have it broken up into triangles, based on the Delaunay >> > package >> > in SciPy. I have >> > >> > Locations of all vertex coordinates, >> > list of vertices that make up faces >> > list of faces that make cells >> > list of faces that make up all the internal and external boundaries. >> > >> > Can you point me to any code or documentation that would help me >> > understand >> > how to make this into a Mesh2D object? I am having a devil of a time >> > figuring out from the manual online. The best would be something that >> > used >> > the output of either the triangles or scipy.spatial.Delaunay() packaged. >> > My >> > equation is of the form >> > >> > 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi) >> > >> > >> > and I can get the coefficients A(x,y) and B(x,y) on either the faces or >> > in >> > the cell centers are needed. >> > >> > Thank you. >> > Jamie Pringle >> > University of New Hampshire >> >> -- >> Daniel Wheeler >> _______________________________________________ >> fipy mailing list >> fipy@nist.gov >> >> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ctcms.nist.gov_fipy&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=Q6M6XDjzGDlxMDgrY-riZ7Q70Abl5Aq7SRrTwZNYsws&s=yiO9QAq_3EUy9lVY5F76Tc9mnaB5Ubclilpum_QCUOE&e= >> [ NIST internal ONLY: >> https://urldefense.proofpoint.com/v2/url?u=https-3A__email.nist.gov_mailman_listinfo_fipy&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=Q6M6XDjzGDlxMDgrY-riZ7Q70Abl5Aq7SRrTwZNYsws&s=yIJJw-iQknimZfYCRrZmk7V2eHSJrCtcAehgVbGeiDk&e= >> ] > > > > _______________________________________________ > fipy mailing list > fipy@nist.gov > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] > -- Daniel Wheeler _______________________________________________ fipy mailing list fipy@nist.gov http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]