Re: how to create large grid with holes and odd geometry

2016-06-16 Thread James Pringle
I have successfully written and tested code to convert the output of
spicy.spatial.Delaunay's triangulation into a fipy mesh. I have posted it
to this mailing list under a separate message with the title "scipy's
Delaunay output to fipy mesh2D object"

Jamie Pringle
University of New Hampshire
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-15 Thread James Pringle
Jonathan and Daniel -- Thanks. In a few days or so, I shall post what I
come up with for others to use.
Jamie

On Wed, Jun 15, 2016 at 3:58 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> You can generate a simple mesh in order to probe what's stored by doing
> something like:
>
>   mesh1 = fp.Grid2D(nx=2, ny=2)
>   mesh2 = fp.Grid2D(nx=2, ny=2) + [[2], [1]]
>   mesh = mesh1 + mesh2
>
>
> > On Jun 15, 2016, at 2:06 PM, James Pringle  wrote:
> >
> > Jonathan --
> >
> > Thank you, this is exactly what I need. Two more questions.
> >   • Is the order of the vertices in faceVertexIDs important?
> >   • Is the order of faces in cellFaceIDs important? Must they wind
> clockwise or counterclockwise?
> > Thanks,
> > Jamie
> >
> > On Wed, Jun 15, 2016 at 1:56 PM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
> > The first three arguments to the Mesh2D constructor are (all that is)
> required:
> >
> >   class Mesh2D(Mesh):
> >   def __init__(self, vertexCoords, faceVertexIDs, cellFaceIDs, ...):
> >
> > All other arguments have default values assigned.
> >
> > For your case:
> >
> > vertexCoords is of shape (2, N) where N is the number of vertices
> > faceVertexIDs is of shape (2, M) where M is the number of faces
> > cellFaceIDs is of shape (3, P) where P is the number of cells
> >
> > faceVertexIDs and cellFaceIDs are 0-based, as they are indices into the
> preceding array
> >
> > > On Jun 15, 2016, at 1:29 PM, James Pringle  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 
> 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=yiO9QA

Re: how to create large grid with holes and odd geometry

2016-06-15 Thread Guyer, Jonathan E. Dr. (Fed)
You can generate a simple mesh in order to probe what's stored by doing 
something like:

  mesh1 = fp.Grid2D(nx=2, ny=2)
  mesh2 = fp.Grid2D(nx=2, ny=2) + [[2], [1]]
  mesh = mesh1 + mesh2


> On Jun 15, 2016, at 2:06 PM, James Pringle  wrote:
> 
> Jonathan -- 
> 
> Thank you, this is exactly what I need. Two more questions. 
>   • Is the order of the vertices in faceVertexIDs important?
>   • Is the order of faces in cellFaceIDs important? Must they wind 
> clockwise or counterclockwise?
> Thanks,
> Jamie
> 
> On Wed, Jun 15, 2016 at 1:56 PM, Guyer, Jonathan E. Dr. (Fed) 
>  wrote:
> The first three arguments to the Mesh2D constructor are (all that is) 
> required:
> 
>   class Mesh2D(Mesh):
>   def __init__(self, vertexCoords, faceVertexIDs, cellFaceIDs, ...):
> 
> All other arguments have default values assigned.
> 
> For your case:
> 
> vertexCoords is of shape (2, N) where N is the number of vertices
> faceVertexIDs is of shape (2, M) where M is the number of faces
> cellFaceIDs is of shape (3, P) where P is the number of cells
> 
> faceVertexIDs and cellFaceIDs are 0-based, as they are indices into the 
> preceding array
> 
> > On Jun 15, 2016, at 1:29 PM, James Pringle  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 
> >  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  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=
> >   ]
> >
> > ___
> > 

Re: how to create large grid with holes and odd geometry

2016-06-15 Thread Guyer, Jonathan E. Dr. (Fed)
The answer to both is "I don't think so"

> On Jun 15, 2016, at 2:06 PM, James Pringle  wrote:
> 
> Jonathan -- 
> 
> Thank you, this is exactly what I need. Two more questions. 
>   • Is the order of the vertices in faceVertexIDs important?
>   • Is the order of faces in cellFaceIDs important? Must they wind 
> clockwise or counterclockwise?
> Thanks,
> Jamie
> 
> On Wed, Jun 15, 2016 at 1:56 PM, Guyer, Jonathan E. Dr. (Fed) 
>  wrote:
> The first three arguments to the Mesh2D constructor are (all that is) 
> required:
> 
>   class Mesh2D(Mesh):
>   def __init__(self, vertexCoords, faceVertexIDs, cellFaceIDs, ...):
> 
> All other arguments have default values assigned.
> 
> For your case:
> 
> vertexCoords is of shape (2, N) where N is the number of vertices
> faceVertexIDs is of shape (2, M) where M is the number of faces
> cellFaceIDs is of shape (3, P) where P is the number of cells
> 
> faceVertexIDs and cellFaceIDs are 0-based, as they are indices into the 
> preceding array
> 
> > On Jun 15, 2016, at 1:29 PM, James Pringle  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 
> >  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  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
> > https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ctcms.nist.gov_fipy&d=CwIGaQ&c=c6MrceVCY5m5A_KAUkrdoA&

Re: how to create large grid with holes and odd geometry

2016-06-15 Thread Daniel Wheeler
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  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 
> 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  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

Re: how to create large grid with holes and odd geometry

2016-06-15 Thread James Pringle
Jonathan --

Thank you, this is exactly what I need. Two more questions.

   1. Is the order of the vertices in faceVertexIDs important?
   2. Is the order of faces in cellFaceIDs important? Must they wind
   clockwise or counterclockwise?

Thanks,
Jamie

On Wed, Jun 15, 2016 at 1:56 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> The first three arguments to the Mesh2D constructor are (all that is)
> required:
>
>   class Mesh2D(Mesh):
>   def __init__(self, vertexCoords, faceVertexIDs, cellFaceIDs, ...):
>
> All other arguments have default values assigned.
>
> For your case:
>
> vertexCoords is of shape (2, N) where N is the number of vertices
> faceVertexIDs is of shape (2, M) where M is the number of faces
> cellFaceIDs is of shape (3, P) where P is the number of cells
>
> faceVertexIDs and cellFaceIDs are 0-based, as they are indices into the
> preceding array
>
> > On Jun 15, 2016, at 1:29 PM, James Pringle  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  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
> >
> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ctcms.nist.gov_fipy&d=CwIGaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=iGk4QC0NEBSkRipnXJcMmV0qOdCYUWc6oQMIUpAmqyI&s=1tQAVl8UCyd9BiwQBhF_rRh-tByp33v

Re: how to create large grid with holes and odd geometry

2016-06-15 Thread Guyer, Jonathan E. Dr. (Fed)
The first three arguments to the Mesh2D constructor are (all that is) required:

  class Mesh2D(Mesh):
  def __init__(self, vertexCoords, faceVertexIDs, cellFaceIDs, ...):

All other arguments have default values assigned. 

For your case:

vertexCoords is of shape (2, N) where N is the number of vertices
faceVertexIDs is of shape (2, M) where M is the number of faces
cellFaceIDs is of shape (3, P) where P is the number of cells

faceVertexIDs and cellFaceIDs are 0-based, as they are indices into the 
preceding array

> On Jun 15, 2016, at 1:29 PM, James Pringle  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  
> 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  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 ]


___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-15 Thread James Pringle
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

   1. a definition of which parts of the Mesh2D object must exist
   2. 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 
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  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 ]


Re: how to create large grid with holes and odd geometry

2016-06-15 Thread Daniel Wheeler
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  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
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-14 Thread James Pringle
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

   1. Locations of all vertex coordinates,
   2. list of vertices that make up faces
   3. list of faces that make cells
   4. 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



On Wed, Jun 8, 2016 at 2:13 PM, Pringle, James 
wrote:

> Thank you. Because of the regular nature of the original data, it is easy
> to make it all triangles.
>
> Cheers,
> Jamie
>
>
> On Wed, Jun 8, 2016 at 2:10 PM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
>
>> Meshes with holes are not a problem for FiPy. Daniel will be happy to
>> help you create a Mesh2D from the output of the triangle package.
>> Basically, you need a list of vertex coordinates, a list of vertex IDs that
>> make up faces, and a list of faces that make up cells. Having all triangles
>> should be pretty easy; it gets messy when you've got mixes of different
>> cell topologies.
>>
>> > On Jun 8, 2016, at 10:57 AM, James Pringle  wrote:
>> >
>> > Thank you; the axes were indeed in grid spacing, and your back of the
>> envelope calculation of sparsity was exactly correct.
>> >
>> > I am now playing around with the python triangle package to create a
>> triangular mesh with the appropriate holes and boundary defined. (e.g.
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__dzhelil.info_triangle__data-2D4.png&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=k71WczOQwQx8_RK9cU8wRK_X2spChhXjIrj5C0zWgw4&s=Qk6jAmccEUMVpP5TFa_gtI6T1b4bSBcRfmUOVIkzC-s&e=
>> ) .
>> >
>> > What is the best way to covert the triangle data (similar in form to
>> scipy.spatial.Delaunay output) into the form fipy likes -- or what is the
>> best documentation of the fipy mesh data structure?
>> >
>> > Does FiPy have the capability to deal with holes in a triangle mesh,
>> and have BC's on them? I did see the trick that Danial Wheeler mentioned.
>> Thanks!
>> >
>> > After I get the mesh, I was planing to reverse engineer the output of
>> fipy.meshes.gmshMesh.Gmsh2D to figure out how to get my mesh into fipy if
>> you don't mention something better.
>> >
>> > Thanks a bunch,
>> > Jamie
>> >
>> > On Wed, Jun 8, 2016 at 1:46 PM, Guyer, Jonathan E. Dr. (Fed) <
>> jonathan.gu...@nist.gov> wrote:
>> > If the domain were not so large and so sparse, I'd be inclined to
>> create a simple, rectilinear Grid2D of the full extent and then use known
>> coefficients to mask out (set B to zero?) the solution where you don't
>> know/care.
>> >
>> > Assuming the axes are labeled in grid spacings (?), then your mesh
>> would have around 5 million elements in it, with fewer than 1 million
>> actually being solved (although it looks like even less than 20% of the
>> domain is active). I don't think that would perform very well.
>> >
>> > I'm not thinking of anything clever with Gmsh off the top of my head.
>> >
>> > You could break the total domain into sub-grids, only instantiate the
>> corresponding Grid2D's if they're not empty, and then concatenate them
>> together. Sketching:
>> >
>> > A B C D
>> >  +-+-+-+-+
>> > 1| | **  | | |
>> >  | |  ** | | |
>> >  +-+-+-+-+
>> > 2| |*|**   | |
>> >  | | |* *  | |
>> >  +-+-+-+-+
>> > 3| | | *** | |
>> >  | | |  ***| |
>> >  +-+-+-+-+
>> > 4| | |   **|*|
>> >  | | |*| *   |
>> >  +-+-+-+-+
>> >
>> >
>> > mesh = gridB1 + gridB2 + gridC2 + gridC3 + gridC4 + gridD4
>> >
>> >
>> >
>> >
>> > > On Jun 7, 2016, at 10:46 AM, James Pringle  wrote:
>> > >
>> > > Dear mailing list & developers --
>> > >
>> > > I am looking for hints on the best way to proceed in creating a
>> grid/mesh for a rather complex geometry. I am just looking for which method
>> (Gmsh or something else?) to start with, so I can most efficiently start
>> coding without exploring blind alleys.
>> > >
>> > > I am solving an elliptic/advective problem of the form
>> > >
>> > > 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
>> > >
>> > > where Psi is the variable to solve for, and A(x,y) and B(x,y) are
>> coefficients known on a set of discrete points shown as black in
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__dl.dropboxusercont

Re: how to create large grid with holes and odd geometry

2016-06-08 Thread James Pringle
Thank you. Because of the regular nature of the original data, it is easy
to make it all triangles.

Cheers,
Jamie

On Wed, Jun 8, 2016 at 2:10 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> Meshes with holes are not a problem for FiPy. Daniel will be happy to help
> you create a Mesh2D from the output of the triangle package. Basically, you
> need a list of vertex coordinates, a list of vertex IDs that make up faces,
> and a list of faces that make up cells. Having all triangles should be
> pretty easy; it gets messy when you've got mixes of different cell
> topologies.
>
> > On Jun 8, 2016, at 10:57 AM, James Pringle  wrote:
> >
> > Thank you; the axes were indeed in grid spacing, and your back of the
> envelope calculation of sparsity was exactly correct.
> >
> > I am now playing around with the python triangle package to create a
> triangular mesh with the appropriate holes and boundary defined. (e.g.
> https://urldefense.proofpoint.com/v2/url?u=http-3A__dzhelil.info_triangle__data-2D4.png&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=k71WczOQwQx8_RK9cU8wRK_X2spChhXjIrj5C0zWgw4&s=Qk6jAmccEUMVpP5TFa_gtI6T1b4bSBcRfmUOVIkzC-s&e=
> ) .
> >
> > What is the best way to covert the triangle data (similar in form to
> scipy.spatial.Delaunay output) into the form fipy likes -- or what is the
> best documentation of the fipy mesh data structure?
> >
> > Does FiPy have the capability to deal with holes in a triangle mesh, and
> have BC's on them? I did see the trick that Danial Wheeler mentioned.
> Thanks!
> >
> > After I get the mesh, I was planing to reverse engineer the output of
> fipy.meshes.gmshMesh.Gmsh2D to figure out how to get my mesh into fipy if
> you don't mention something better.
> >
> > Thanks a bunch,
> > Jamie
> >
> > On Wed, Jun 8, 2016 at 1:46 PM, Guyer, Jonathan E. Dr. (Fed) <
> jonathan.gu...@nist.gov> wrote:
> > If the domain were not so large and so sparse, I'd be inclined to create
> a simple, rectilinear Grid2D of the full extent and then use known
> coefficients to mask out (set B to zero?) the solution where you don't
> know/care.
> >
> > Assuming the axes are labeled in grid spacings (?), then your mesh would
> have around 5 million elements in it, with fewer than 1 million actually
> being solved (although it looks like even less than 20% of the domain is
> active). I don't think that would perform very well.
> >
> > I'm not thinking of anything clever with Gmsh off the top of my head.
> >
> > You could break the total domain into sub-grids, only instantiate the
> corresponding Grid2D's if they're not empty, and then concatenate them
> together. Sketching:
> >
> > A B C D
> >  +-+-+-+-+
> > 1| | **  | | |
> >  | |  ** | | |
> >  +-+-+-+-+
> > 2| |*|**   | |
> >  | | |* *  | |
> >  +-+-+-+-+
> > 3| | | *** | |
> >  | | |  ***| |
> >  +-+-+-+-+
> > 4| | |   **|*|
> >  | | |*| *   |
> >  +-+-+-+-+
> >
> >
> > mesh = gridB1 + gridB2 + gridC2 + gridC3 + gridC4 + gridD4
> >
> >
> >
> >
> > > On Jun 7, 2016, at 10:46 AM, James Pringle  wrote:
> > >
> > > Dear mailing list & developers --
> > >
> > > I am looking for hints on the best way to proceed in creating a
> grid/mesh for a rather complex geometry. I am just looking for which method
> (Gmsh or something else?) to start with, so I can most efficiently start
> coding without exploring blind alleys.
> > >
> > > I am solving an elliptic/advective problem of the form
> > >
> > > 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
> > >
> > > where Psi is the variable to solve for, and A(x,y) and B(x,y) are
> coefficients known on a set of discrete points shown as black in
> https://urldefense.proofpoint.com/v2/url?u=https-3A__dl.dropboxusercontent.com_u_382250_Grid01.png&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=pa2VS0gonWbqlcwLDzR4QyP-iFHDpvnSHIqg-fk0QD4&s=ctz2HUgelmtveB6M5tJgv57BV8OqeCl3-MMJoIQOtmk&e=
> . The black appears solid because the grid is dense.
> > >
> > > The locations of the points where the coefficients are known define
> the grid. The number of points is large (911130 points) and they are evenly
> spaced where they exist. Note that there are holes in the domain that
> represent actual islands in the ocean.
> > >
> > > I am happy to keep the resolution of the grid/mesh equal to the
> spacing of the points where the coefficients are known.
> > >
> > > What is the best way to approach creating a grid for this problem? I
> would love code, of course, but would be very happy with suggestions of the
> best way to start.
> > >
> > > Thanks
> > > Jamie Pringle
> > > University of New Hampshire
> > > ___
> > > fipy mailing list
> > ___
> > fipy mailing list
> >

Re: how to create large grid with holes and odd geometry

2016-06-08 Thread Guyer, Jonathan E. Dr. (Fed)
Meshes with holes are not a problem for FiPy. Daniel will be happy to help you 
create a Mesh2D from the output of the triangle package. Basically, you need a 
list of vertex coordinates, a list of vertex IDs that make up faces, and a list 
of faces that make up cells. Having all triangles should be pretty easy; it 
gets messy when you've got mixes of different cell topologies.

> On Jun 8, 2016, at 10:57 AM, James Pringle  wrote:
> 
> Thank you; the axes were indeed in grid spacing, and your back of the 
> envelope calculation of sparsity was exactly correct. 
> 
> I am now playing around with the python triangle package to create a 
> triangular mesh with the appropriate holes and boundary defined. (e.g. 
> http://dzhelil.info/triangle//data-4.png ) . 
> 
> What is the best way to covert the triangle data (similar in form to 
> scipy.spatial.Delaunay output) into the form fipy likes -- or what is the 
> best documentation of the fipy mesh data structure?
> 
> Does FiPy have the capability to deal with holes in a triangle mesh, and have 
> BC's on them? I did see the trick that Danial Wheeler mentioned. Thanks!
> 
> After I get the mesh, I was planing to reverse engineer the output of 
> fipy.meshes.gmshMesh.Gmsh2D to figure out how to get my mesh into fipy if you 
> don't mention something better. 
> 
> Thanks a bunch,
> Jamie
> 
> On Wed, Jun 8, 2016 at 1:46 PM, Guyer, Jonathan E. Dr. (Fed) 
>  wrote:
> If the domain were not so large and so sparse, I'd be inclined to create a 
> simple, rectilinear Grid2D of the full extent and then use known coefficients 
> to mask out (set B to zero?) the solution where you don't know/care.
> 
> Assuming the axes are labeled in grid spacings (?), then your mesh would have 
> around 5 million elements in it, with fewer than 1 million actually being 
> solved (although it looks like even less than 20% of the domain is active). I 
> don't think that would perform very well.
> 
> I'm not thinking of anything clever with Gmsh off the top of my head.
> 
> You could break the total domain into sub-grids, only instantiate the 
> corresponding Grid2D's if they're not empty, and then concatenate them 
> together. Sketching:
> 
> A B C D
>  +-+-+-+-+
> 1| | **  | | |
>  | |  ** | | |
>  +-+-+-+-+
> 2| |*|**   | |
>  | | |* *  | |
>  +-+-+-+-+
> 3| | | *** | |
>  | | |  ***| |
>  +-+-+-+-+
> 4| | |   **|*|
>  | | |*| *   |
>  +-+-+-+-+
> 
> 
> mesh = gridB1 + gridB2 + gridC2 + gridC3 + gridC4 + gridD4
> 
> 
> 
> 
> > On Jun 7, 2016, at 10:46 AM, James Pringle  wrote:
> >
> > Dear mailing list & developers --
> >
> > I am looking for hints on the best way to proceed in creating a 
> > grid/mesh for a rather complex geometry. I am just looking for which method 
> > (Gmsh or something else?) to start with, so I can most efficiently start 
> > coding without exploring blind alleys.
> >
> > I am solving an elliptic/advective problem of the form
> >
> > 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
> >
> > where Psi is the variable to solve for, and A(x,y) and B(x,y) are 
> > coefficients known on a set of discrete points shown as black in 
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__dl.dropboxusercontent.com_u_382250_Grid01.png&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=pa2VS0gonWbqlcwLDzR4QyP-iFHDpvnSHIqg-fk0QD4&s=ctz2HUgelmtveB6M5tJgv57BV8OqeCl3-MMJoIQOtmk&e=
> >   . The black appears solid because the grid is dense.
> >
> > The locations of the points where the coefficients are known define the 
> > grid. The number of points is large (911130 points) and they are evenly 
> > spaced where they exist. Note that there are holes in the domain that 
> > represent actual islands in the ocean.
> >
> > I am happy to keep the resolution of the grid/mesh equal to the spacing of 
> > the points where the coefficients are known.
> >
> > What is the best way to approach creating a grid for this problem? I would 
> > love code, of course, but would be very happy with suggestions of the best 
> > way to start.
> >
> > Thanks
> > Jamie Pringle
> > University of New Hampshire
> > ___
> > fipy mailing list
> ___
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-08 Thread James Pringle
Thank you; the axes were indeed in grid spacing, and your back of the
envelope calculation of sparsity was exactly correct.

I am now playing around with the python triangle package to create a
triangular mesh with the appropriate holes and boundary defined. (e.g.
http://dzhelil.info/triangle//data-4.png ) .

What is the best way to covert the triangle data (similar in form to
scipy.spatial.Delaunay output) into the form fipy likes -- or what is the
best documentation of the fipy mesh data structure?

Does FiPy have the capability to deal with holes in a triangle mesh, and
have BC's on them? I did see the trick that Danial Wheeler mentioned.
Thanks!

After I get the mesh, I was planing to reverse engineer the output of
fipy.meshes.gmshMesh.Gmsh2D to figure out how to get my mesh into fipy if
you don't mention something better.

Thanks a bunch,
Jamie

On Wed, Jun 8, 2016 at 1:46 PM, Guyer, Jonathan E. Dr. (Fed) <
jonathan.gu...@nist.gov> wrote:

> If the domain were not so large and so sparse, I'd be inclined to create a
> simple, rectilinear Grid2D of the full extent and then use known
> coefficients to mask out (set B to zero?) the solution where you don't
> know/care.
>
> Assuming the axes are labeled in grid spacings (?), then your mesh would
> have around 5 million elements in it, with fewer than 1 million actually
> being solved (although it looks like even less than 20% of the domain is
> active). I don't think that would perform very well.
>
> I'm not thinking of anything clever with Gmsh off the top of my head.
>
> You could break the total domain into sub-grids, only instantiate the
> corresponding Grid2D's if they're not empty, and then concatenate them
> together. Sketching:
>
> A B C D
>  +-+-+-+-+
> 1| | **  | | |
>  | |  ** | | |
>  +-+-+-+-+
> 2| |*|**   | |
>  | | |* *  | |
>  +-+-+-+-+
> 3| | | *** | |
>  | | |  ***| |
>  +-+-+-+-+
> 4| | |   **|*|
>  | | |*| *   |
>  +-+-+-+-+
>
>
> mesh = gridB1 + gridB2 + gridC2 + gridC3 + gridC4 + gridD4
>
>
>
>
> > On Jun 7, 2016, at 10:46 AM, James Pringle  wrote:
> >
> > Dear mailing list & developers --
> >
> > I am looking for hints on the best way to proceed in creating a
> grid/mesh for a rather complex geometry. I am just looking for which method
> (Gmsh or something else?) to start with, so I can most efficiently start
> coding without exploring blind alleys.
> >
> > I am solving an elliptic/advective problem of the form
> >
> > 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
> >
> > where Psi is the variable to solve for, and A(x,y) and B(x,y) are
> coefficients known on a set of discrete points shown as black in
> https://urldefense.proofpoint.com/v2/url?u=https-3A__dl.dropboxusercontent.com_u_382250_Grid01.png&d=CwICAg&c=c6MrceVCY5m5A_KAUkrdoA&r=oMf1-WHpUHeD7kN3S7612CDdF2TDPqDF9R-n-71Ks1Y&m=pa2VS0gonWbqlcwLDzR4QyP-iFHDpvnSHIqg-fk0QD4&s=ctz2HUgelmtveB6M5tJgv57BV8OqeCl3-MMJoIQOtmk&e=
> . The black appears solid because the grid is dense.
> >
> > The locations of the points where the coefficients are known define the
> grid. The number of points is large (911130 points) and they are evenly
> spaced where they exist. Note that there are holes in the domain that
> represent actual islands in the ocean.
> >
> > I am happy to keep the resolution of the grid/mesh equal to the spacing
> of the points where the coefficients are known.
> >
> > What is the best way to approach creating a grid for this problem? I
> would love code, of course, but would be very happy with suggestions of the
> best way to start.
> >
> > Thanks
> > Jamie Pringle
> > University of New Hampshire
> > ___
> > fipy mailing list
>
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-08 Thread Daniel Wheeler
On Wed, Jun 8, 2016 at 1:46 PM, Guyer, Jonathan E. Dr. (Fed)
 wrote:

>
> A B C D
>  +-+-+-+-+
> 1| | **  | | |
>  | |  ** | | |
>  +-+-+-+-+
> 2| |*|**   | |
>  | | |* *  | |
>  +-+-+-+-+
> 3| | | *** | |
>  | | |  ***| |
>  +-+-+-+-+
> 4| | |   **|*|
>  | | |*| *   |
>  +-+-+-+-+
>

Jamie, this is nice. If you use this approach and interpolate the
values of A and B then you will have two grid parameters. One for the
subgrid density and one for the internal subgrid spacing. Remember
that the meshes need to be joined (not via a diagonal). There must be
a way to write a simple algorithm to do this.


-- 
Daniel Wheeler
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: how to create large grid with holes and odd geometry

2016-06-08 Thread Daniel Wheeler
Hi Jamie,

The simplest way might be just to take a basic grid and just "switch
off" the simulation outside of the black zone. This can be achieved by
including a transient term in the equation and setting the coefficient
to be large in the white zone and zero or something small in the black
zone. That would be an easy first attempt to solve the problem. Of
course this approach has a lot of redundancy, but would be a good
first step. You may have to interpolate the A and B values to a
coarser grid for this approach to be feasible.

It is possible in FiPy to combine grid's into odd shaped
non-rectangular grids. You could do this with say 20 or 30 smaller
grids to better isolate the black region. I still think that you want
to interpolate the values of A and B so you have control over the grid
density. You don't necessarily need a grid density at the sample
density. Also, you will still need the trick with the Transient Term.
Furthermore, the grids must align and not overlap. It will take quite
a bit of programming to set this up so that you have control over the
grid density and the number of subgrids to isolate the black region.

Gmsh will probably be happy meshing the black region, but will
probably use triangles rather than a grid.

To summarize use the first approach to make things work right and then
refine with the second approach.

Hope it helps.

On Tue, Jun 7, 2016 at 1:46 PM, James Pringle  wrote:
> Dear mailing list & developers --
>
> I am looking for hints on the best way to proceed in creating a
> grid/mesh for a rather complex geometry. I am just looking for which method
> (Gmsh or something else?) to start with, so I can most efficiently start
> coding without exploring blind alleys.
>
> I am solving an elliptic/advective problem of the form
>
> 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
>
> where Psi is the variable to solve for, and A(x,y) and B(x,y) are
> coefficients known on a set of discrete points shown as black in
> https://dl.dropboxusercontent.com/u/382250/Grid01.png . The black appears
> solid because the grid is dense.
>
> The locations of the points where the coefficients are known define the
> grid. The number of points is large (911130 points) and they are evenly
> spaced where they exist. Note that there are holes in the domain that
> represent actual islands in the ocean.
>
> I am happy to keep the resolution of the grid/mesh equal to the spacing of
> the points where the coefficients are known.
>
> What is the best way to approach creating a grid for this problem? I would
> love code, of course, but would be very happy with suggestions of the best
> way to start.
>
> Thanks
> Jamie Pringle
> University of New Hampshire
>
> ___
> 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 ]


Re: how to create large grid with holes and odd geometry

2016-06-08 Thread Guyer, Jonathan E. Dr. (Fed)
If the domain were not so large and so sparse, I'd be inclined to create a 
simple, rectilinear Grid2D of the full extent and then use known coefficients 
to mask out (set B to zero?) the solution where you don't know/care.

Assuming the axes are labeled in grid spacings (?), then your mesh would have 
around 5 million elements in it, with fewer than 1 million actually being 
solved (although it looks like even less than 20% of the domain is active). I 
don't think that would perform very well.

I'm not thinking of anything clever with Gmsh off the top of my head.

You could break the total domain into sub-grids, only instantiate the 
corresponding Grid2D's if they're not empty, and then concatenate them 
together. Sketching:

A B C D
 +-+-+-+-+
1| | **  | | |
 | |  ** | | |
 +-+-+-+-+
2| |*|**   | |
 | | |* *  | |
 +-+-+-+-+
3| | | *** | |
 | | |  ***| |
 +-+-+-+-+
4| | |   **|*|
 | | |*| *   |
 +-+-+-+-+


mesh = gridB1 + gridB2 + gridC2 + gridC3 + gridC4 + gridD4




> On Jun 7, 2016, at 10:46 AM, James Pringle  wrote:
> 
> Dear mailing list & developers -- 
> 
> I am looking for hints on the best way to proceed in creating a grid/mesh 
> for a rather complex geometry. I am just looking for which method (Gmsh or 
> something else?) to start with, so I can most efficiently start coding 
> without exploring blind alleys. 
> 
> I am solving an elliptic/advective problem of the form 
> 
> 0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)
> 
> where Psi is the variable to solve for, and A(x,y) and B(x,y) are 
> coefficients known on a set of discrete points shown as black in 
> https://dl.dropboxusercontent.com/u/382250/Grid01.png . The black appears 
> solid because the grid is dense. 
> 
> The locations of the points where the coefficients are known define the grid. 
> The number of points is large (911130 points) and they are evenly spaced 
> where they exist. Note that there are holes in the domain that represent 
> actual islands in the ocean.
> 
> I am happy to keep the resolution of the grid/mesh equal to the spacing of 
> the points where the coefficients are known. 
> 
> What is the best way to approach creating a grid for this problem? I would 
> love code, of course, but would be very happy with suggestions of the best 
> way to start. 
> 
> Thanks 
> Jamie Pringle
> University of New Hampshire
> ___
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


how to create large grid with holes and odd geometry

2016-06-07 Thread James Pringle
Dear mailing list & developers --

I am looking for hints on the best way to proceed in creating a
grid/mesh for a rather complex geometry. I am just looking for which method
(Gmsh or something else?) to start with, so I can most efficiently start
coding without exploring blind alleys.

I am solving an elliptic/advective problem of the form

0=J(Psi,A(x,y)) + \Del(B(x,y)*\Del Psi)

where Psi is the variable to solve for, and A(x,y) and B(x,y) are
coefficients known on a set of discrete points shown as black in
https://dl.dropboxusercontent.com/u/382250/Grid01.png . The black appears
solid because the grid is dense.

The locations of the points where the coefficients are known define the
grid. The number of points is large (911130 points) and they are evenly
spaced where they exist. Note that there are holes in the domain that
represent actual islands in the ocean.

I am happy to keep the resolution of the grid/mesh equal to the spacing of
the points where the coefficients are known.

What is the best way to approach creating a grid for this problem? I would
love code, of course, but would be very happy with suggestions of the best
way to start.

Thanks
Jamie Pringle
University of New Hampshire
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]