Re: Some questions on the viewer

2020-01-23 Thread Daniel Wheeler
On Thu, Jan 23, 2020 at 11:37 AM Guyer, Jonathan E. Dr. (Fed) via fipy
 wrote:
>
> I'm not sure why you are skeptical. FiPy does not use VTK internally, so the 
> fact that the FiPy mesh is defined appropriately for its own use has nothing 
> to do with whether we export it correctly as VTK. It would appear that we do 
> not output VTK_CONVEX_POINT_SETs correctly.

FiPy doesn't order the cell to face indices, face to vertex indices or
cell to vertex indices in any particular way. It doesn't matter for
the FV method. It only matters for the direction of the normals and
that's accounted for. I remember that those orderings are wrong for
VTK as that does require a specific ordering (right (or left) hand
rule or something like that).

-- 
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: Some questions on the viewer

2020-01-23 Thread Guyer, Jonathan E. Dr. (Fed) via fipy
I'm not sure why you are skeptical. FiPy does not use VTK internally, so the 
fact that the FiPy mesh is defined appropriately for its own use has nothing to 
do with whether we export it correctly as VTK. It would appear that we do not 
output VTK_CONVEX_POINT_SETs correctly.


From: A A 
Sent: Thursday, January 23, 2020 6:10 AM
To: Guyer, Jonathan E. Dr. (Fed); FIPY
Subject: Re: Some questions on the viewer

Hi Jon,

It looks like pyvista does support VTK_CONVEX_POINT_SET. Please take a look at 
the discussion I started on 
https://github.com/pyvista/pyvista-support/issues/108

They are claiming that fipy's mesh might be ill-formed which I am a bit 
skeptical about. For instance I think Grid2D works fine, but for some reason I 
still get a blank plot with pyvista.

A contribution from the fipy team on the above discussion would be most useful. 
If there is a resolution I'd be happy to take a look at submitting a pull 
request for a pyvista-enabled Viewer class, though I may need some guidance in 
order not to break things.

Regards,

Amine


On Wed, Jan 22, 2020 at 6:19 PM Guyer, Jonathan E. Dr. (Fed) via fipy 
mailto:fipy@nist.gov>> wrote:
FiPy can have completely general polyhedral cells, whereas VTK is more 
restrictive. In principle, VTK_CONVEX_POINT_SET allows the same generality, but 
as you've seen, this cell type is not implemented by many tools using VTK.

General 2D meshes know to export VTK_POLYGONs, which are widely understood.

2D grids bypass this specialization for historical reasons and so just get the 
default VTK_CONVEX_POINT_SET. We've never had any call to render 2D grids with 
VTK tools, so we've not noticed this before. Grid meshes should be exported as 
VTK_PIXEL or VTK_VOXEL. Fixing in this in FiPy is likely to happen sooner than 
getting any of those other packages to support VTK_CONVEX_POINT_SET. I have a 
(stalled) development that does a better job with mesh io, but higher priority 
tasks have gotten in the way.

> On Jan 22, 2020, at 10:11 AM, A A 
> mailto:amine.aboufir...@gmail.com>> wrote:
>
>
> This is somewhat related to my last comment about visualizing meshes. I'm 
> noticing that both CylindricalGrid2D and Grid2D default to a cell type of 41 
> which according to VTK is a VTK_CONVEX_POINT_SET (see  
> https://vtk.org/doc/nightly/html/vtkCellType_8h_source.html<https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvtk.org%2Fdoc%2Fnightly%2Fhtml%2FvtkCellType_8h_source.html&data=02%7C01%7Cjonathan.guyer%40nist.gov%7C5610ae87d73b44e97ca208d79ff4dec5%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C1%7C637153746369115046&sdata=%2BAIrNqP67P9zTUr7UfO%2BKj6Avo6gHUQ4q0GfizRHb50%3D&reserved=0>).
>  Interestingly, the mesh generated in fipy's circle diffusion example  using 
> gmesh capability results in a mesh of cell type 7 which is a VTK_POLYGON. I'm 
> suspecting that the third party libraries I'm using to plot these meshes 
> might be limited to cell types with numbers ranging from 0 to 35 thus not 
> including fipy's choice of cell type 41.
>
> Is the choice of the cell type intentional or important here? If so it might 
> be worth convincing those libraries to add cell type 41 plotting and i/o 
> capabilities.
> -- Forwarded message -
> From: A A mailto:amine.aboufir...@gmail.com>>
> Date: Wed, Jan 22, 2020 at 12:22 PM
> Subject: Re: Some questions on the viewer
> To: Guyer, Jonathan E. Dr. (Fed) 
> mailto:jonathan.gu...@nist.gov>>, 
> mailto:fipy@nist.gov>>
>
>
> Hi Jonathan,
>
> The lines do remain dashed on successive calls. I guess the viewer keeps 
> pointing to the right objects even if their properties are retroactively 
> modified.
>
> Here's what I mean about the diffusion term:
>
> 
>
> On another note, I've posted some stuff on github which may be of interest 
> regarding the circle diffusion example. I had a hard time visualizing the 
> mesh so I went with some third-party packages (pyvista, pygmsh) and the 
> result looks quite nice. https://github.com/usnistgov/fipy/issues/693
>
> I'm now experimenting with cylindrical coordinates as I would like to try to 
> solve the heat equation in radial terms. I tried repeating the above 
> procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but 
> without much luck. Here's what I'm doing:
>
> from fipy import Variable, FaceVariable, CellVariable, Grid1D, 
> CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm, 
> DiffusionTerm, Viewer
> from fipy.tools import numerix
> import numpy as np
> import pyvista
>
> mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
> ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)

Re: Some questions on the viewer

2020-01-23 Thread A A
Hi Jon,

It looks like pyvista *does* support VTK_CONVEX_POINT_SET. Please take a
look at the discussion I started on
https://github.com/pyvista/pyvista-support/issues/108

They are claiming that fipy's mesh might be ill-formed which I am a bit
skeptical about. For instance I think Grid2D works fine, but for some
reason I still get a blank plot with pyvista.

A contribution from the fipy team on the above discussion would be most
useful. If there is a resolution I'd be happy to take a look at submitting
a pull request for a pyvista-enabled Viewer class, though I may need some
guidance in order not to break things.

Regards,

Amine


On Wed, Jan 22, 2020 at 6:19 PM Guyer, Jonathan E. Dr. (Fed) via fipy <
fipy@nist.gov> wrote:

> FiPy can have completely general polyhedral cells, whereas VTK is more
> restrictive. In principle, VTK_CONVEX_POINT_SET allows the same generality,
> but as you've seen, this cell type is not implemented by many tools using
> VTK.
>
> General 2D meshes know to export VTK_POLYGONs, which are widely understood.
>
> 2D grids bypass this specialization for historical reasons and so just get
> the default VTK_CONVEX_POINT_SET. We've never had any call to render 2D
> grids with VTK tools, so we've not noticed this before. Grid meshes should
> be exported as VTK_PIXEL or VTK_VOXEL. Fixing in this in FiPy is likely to
> happen sooner than getting any of those other packages to support
> VTK_CONVEX_POINT_SET. I have a (stalled) development that does a better job
> with mesh io, but higher priority tasks have gotten in the way.
>
> > On Jan 22, 2020, at 10:11 AM, A A  wrote:
> >
> >
> > This is somewhat related to my last comment about visualizing meshes.
> I'm noticing that both CylindricalGrid2D and Grid2D default to a cell type
> of 41 which according to VTK is a VTK_CONVEX_POINT_SET (see
> https://vtk.org/doc/nightly/html/vtkCellType_8h_source.html).
> Interestingly, the mesh generated in fipy's circle diffusion example  using
> gmesh capability results in a mesh of cell type 7 which is a VTK_POLYGON.
> I'm suspecting that the third party libraries I'm using to plot these
> meshes might be limited to cell types with numbers ranging from 0 to 35
> thus not including fipy's choice of cell type 41.
> >
> > Is the choice of the cell type intentional or important here? If so it
> might be worth convincing those libraries to add cell type 41 plotting and
> i/o capabilities.
> > -- Forwarded message -
> > From: A A 
> > Date: Wed, Jan 22, 2020 at 12:22 PM
> > Subject: Re: Some questions on the viewer
> > To: Guyer, Jonathan E. Dr. (Fed) , <
> fipy@nist.gov>
> >
> >
> > Hi Jonathan,
> >
> > The lines do remain dashed on successive calls. I guess the viewer keeps
> pointing to the right objects even if their properties are retroactively
> modified.
> >
> > Here's what I mean about the diffusion term:
> >
> > 
> >
> > On another note, I've posted some stuff on github which may be of
> interest regarding the circle diffusion example. I had a hard time
> visualizing the mesh so I went with some third-party packages (pyvista,
> pygmsh) and the result looks quite nice.
> https://github.com/usnistgov/fipy/issues/693
> >
> > I'm now experimenting with cylindrical coordinates as I would like to
> try to solve the heat equation in radial terms. I tried repeating the above
> procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but
> without much luck. Here's what I'm doing:
> >
> > from fipy import Variable, FaceVariable, CellVariable, Grid1D,
> CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm,
> DiffusionTerm, Viewer
> > from fipy.tools import numerix
> > import numpy as np
> > import pyvista
> >
> > mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
> > ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)
> > plotter = pyvista.Plotter()
> > plotter.set_background('white')
> > plotter.add_mesh(ugrid, style='wireframe', color='black')
> > plotter.add_bounding_box(color='red')
> > plotter.show_grid(color="red")
> > plotter.view_xy()
> > plotter.show()
> >
> > I only get the red bounding box/grid but no cylindrical mesh. Is there
> something I'm missing regarding the nature of CylindricalGrid objects? It
> seems that fipy is working with/using VTK under the hood so it would be
> nice to be able to recover it and take a look at what I'm working with...
> >
> > Regards,
> >
> > Amine
> &g

viewing cylindrical grids [was Re: Some questions on the viewer]

2020-01-22 Thread Guyer, Jonathan E. Dr. (Fed) via fipy
I've added comments to your https://github.com/usnistgov/fipy/issues/693, but 
the short answer is that FiPy's not exporting a VTK cell type that pyvista 
understands. FiPy should put out VTK_PIXELs or VTK_QUADs in this case.

> On Jan 22, 2020, at 6:22 AM, A A  wrote:
> 
> On another note, I've posted some stuff on github which may be of interest 
> regarding the circle diffusion example. I had a hard time visualizing the 
> mesh so I went with some third-party packages (pyvista, pygmsh) and the 
> result looks quite nice. https://github.com/usnistgov/fipy/issues/693
> 
> I'm now experimenting with cylindrical coordinates as I would like to try to 
> solve the heat equation in radial terms. I tried repeating the above 
> procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but 
> without much luck. Here's what I'm doing:
> 
> from fipy import Variable, FaceVariable, CellVariable, Grid1D, 
> CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm, 
> DiffusionTerm, Viewer
> from fipy.tools import numerix
> import numpy as np
> import pyvista
> 
> mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
> ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)
> plotter = pyvista.Plotter()
> plotter.set_background('white')
> plotter.add_mesh(ugrid, style='wireframe', color='black')
> plotter.add_bounding_box(color='red')
> plotter.show_grid(color="red")
> plotter.view_xy()
> plotter.show()
> 
> I only get the red bounding box/grid but no cylindrical mesh. Is there 
> something I'm missing regarding the nature of CylindricalGrid objects? It 
> seems that fipy is working with/using VTK under the hood so it would be nice 
> to be able to recover it and take a look at what I'm working with...


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


nth-order diffusion [was Re: Some questions on the viewer]

2020-01-22 Thread Guyer, Jonathan E. Dr. (Fed) via fipy
Amine -

The n is effectively a power, or how many times the operator 
$\nabla\cdot\Gamma\nabla$ should be applied. The index i runs from 1..n to 
denote that each operator gets its own coefficient. 

If n=1, then apply the operator $\nabla\cdot\Gamma_1\nabla$ to the argument 
$\phi$ and you get the "normal" 2nd-order diffusion. 

If n=2, then apply the operator $\nabla\cdot\Gamma_1\nabla$ to the argument 
consisting of the operator ($\nabla\cdot\Gamma_2\nabla$ applied to the argument 
$\phi$) and you get a 4th-order expression that comes up in Cahn-Hilliard 
problems. 

If n=3, then apply the operator $\nabla\cdot\Gamma_1\nabla$ to the argument 
consisting of the operator ($\nabla\cdot\Gamma_2\nabla$ applied to the argument 
($\nabla\cdot\Gamma_3\nabla$ applied to the argument $\phi$)) and you get a 
6th-order expression that comes up in phase field crystal.

Repeat as necessary.

If you don't have terms like this in your equations, don't worry about it. Even 
if you do, you're probably better off doing operator splitting, e.g., instead of

\nabla\cdot(\Gamma_1\nabla[\nabla\cdot\Gamma_2\nabla\phi])

do 

\nabla\cdot(\Gamma_1\nabla\psi)

and

\psi = \nabla\cdot\Gamma_2\nabla\phi

- Jon

> On Jan 22, 2020, at 6:22 AM, A A  wrote:
> 
> Here's what I mean about the diffusion term:
> 
> 
> 


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


Re: Some questions on the viewer

2020-01-22 Thread Guyer, Jonathan E. Dr. (Fed) via fipy
FiPy can have completely general polyhedral cells, whereas VTK is more 
restrictive. In principle, VTK_CONVEX_POINT_SET allows the same generality, but 
as you've seen, this cell type is not implemented by many tools using VTK.

General 2D meshes know to export VTK_POLYGONs, which are widely understood.

2D grids bypass this specialization for historical reasons and so just get the 
default VTK_CONVEX_POINT_SET. We've never had any call to render 2D grids with 
VTK tools, so we've not noticed this before. Grid meshes should be exported as 
VTK_PIXEL or VTK_VOXEL. Fixing in this in FiPy is likely to happen sooner than 
getting any of those other packages to support VTK_CONVEX_POINT_SET. I have a 
(stalled) development that does a better job with mesh io, but higher priority 
tasks have gotten in the way.

> On Jan 22, 2020, at 10:11 AM, A A  wrote:
> 
> 
> This is somewhat related to my last comment about visualizing meshes. I'm 
> noticing that both CylindricalGrid2D and Grid2D default to a cell type of 41 
> which according to VTK is a VTK_CONVEX_POINT_SET (see  
> https://vtk.org/doc/nightly/html/vtkCellType_8h_source.html). Interestingly, 
> the mesh generated in fipy's circle diffusion example  using gmesh capability 
> results in a mesh of cell type 7 which is a VTK_POLYGON. I'm suspecting that 
> the third party libraries I'm using to plot these meshes might be limited to 
> cell types with numbers ranging from 0 to 35 thus not including fipy's choice 
> of cell type 41.
> 
> Is the choice of the cell type intentional or important here? If so it might 
> be worth convincing those libraries to add cell type 41 plotting and i/o 
> capabilities.
> -- Forwarded message ---------
> From: A A 
> Date: Wed, Jan 22, 2020 at 12:22 PM
> Subject: Re: Some questions on the viewer
> To: Guyer, Jonathan E. Dr. (Fed) , 
> 
> 
> Hi Jonathan,
> 
> The lines do remain dashed on successive calls. I guess the viewer keeps 
> pointing to the right objects even if their properties are retroactively 
> modified.
> 
> Here's what I mean about the diffusion term:
> 
> 
> 
> On another note, I've posted some stuff on github which may be of interest 
> regarding the circle diffusion example. I had a hard time visualizing the 
> mesh so I went with some third-party packages (pyvista, pygmsh) and the 
> result looks quite nice. https://github.com/usnistgov/fipy/issues/693
> 
> I'm now experimenting with cylindrical coordinates as I would like to try to 
> solve the heat equation in radial terms. I tried repeating the above 
> procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but 
> without much luck. Here's what I'm doing:
> 
> from fipy import Variable, FaceVariable, CellVariable, Grid1D, 
> CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm, 
> DiffusionTerm, Viewer
> from fipy.tools import numerix
> import numpy as np
> import pyvista
> 
> mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
> ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)
> plotter = pyvista.Plotter()
> plotter.set_background('white')
> plotter.add_mesh(ugrid, style='wireframe', color='black')
> plotter.add_bounding_box(color='red')
> plotter.show_grid(color="red")
> plotter.view_xy()
> plotter.show()
> 
> I only get the red bounding box/grid but no cylindrical mesh. Is there 
> something I'm missing regarding the nature of CylindricalGrid objects? It 
> seems that fipy is working with/using VTK under the hood so it would be nice 
> to be able to recover it and take a look at what I'm working with...
> 
> Regards,
> 
> Amine
> 
> On Tue, Jan 21, 2020 at 3:55 PM Guyer, Jonathan E. Dr. (Fed) via fipy 
>  wrote:
> I'm curious. Do the lines remain dashed on successive calls to plot()?
> 
> As to the third question, where are you seeing exponent n and subscript i? 
> I'm not suggesting we don't use them, just that I don't know where.
> 
> Is the discussion at
> https://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#higher-order-diffusion
> helpful?
> 
> > On Jan 21, 2020, at 1:25 AM, A A  wrote:
> > 
> > Hi Martin,
> > 
> > Thanks for your response. That's strange that such a "dummy" command would 
> > be necessary. 
> > 
> > I was able to answer the second question myself. It is possible to 
> > retroactively change line and axis properties. For the mesh1D example I did 
> > the following:
> > 
> > viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
> > ax = viewer.axes
> > ax.line

Fwd: Some questions on the viewer

2020-01-22 Thread A A
This is somewhat related to my last comment about visualizing meshes. I'm
noticing that both CylindricalGrid2D and Grid2D default to a cell type of
41 which according to VTK is a VTK_CONVEX_POINT_SET (see
https://vtk.org/doc/nightly/html/vtkCellType_8h_source.html).
Interestingly, the mesh generated in fipy's circle diffusion example  using
gmesh capability results in a mesh of cell type 7 which is a VTK_POLYGON.
I'm suspecting that the third party libraries I'm using to plot these
meshes might be limited to cell types with numbers ranging from 0 to 35
thus not including fipy's choice of cell type 41.

Is the choice of the cell type intentional or important here? If so it
might be worth convincing those libraries to add cell type 41 plotting and
i/o capabilities.
-- Forwarded message -
From: A A 
Date: Wed, Jan 22, 2020 at 12:22 PM
Subject: Re: Some questions on the viewer
To: Guyer, Jonathan E. Dr. (Fed) , 


Hi Jonathan,

The lines do remain dashed on successive calls. I guess the viewer keeps
pointing to the right objects even if their properties are retroactively
modified.

Here's what I mean about the diffusion term:

[image: Untitled.png]

On another note, I've posted some stuff on github which may be of interest
regarding the circle diffusion example. I had a hard time visualizing the
mesh so I went with some third-party packages (pyvista, pygmsh) and the
result looks quite nice. https://github.com/usnistgov/fipy/issues/693

I'm now experimenting with cylindrical coordinates as I would like to try
to solve the heat equation in radial terms. I tried repeating the above
procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but
without much luck. Here's what I'm doing:

from fipy import Variable, FaceVariable, CellVariable, Grid1D,
CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm,
DiffusionTerm, Viewer
from fipy.tools import numerix
import numpy as np
import pyvista

mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)
plotter = pyvista.Plotter()
plotter.set_background('white')
plotter.add_mesh(ugrid, style='wireframe', color='black')
plotter.add_bounding_box(color='red')
plotter.show_grid(color="red")
plotter.view_xy()
plotter.show()

I only get the red bounding box/grid but no cylindrical mesh. Is there
something I'm missing regarding the nature of CylindricalGrid objects? It
seems that fipy is working with/using VTK under the hood so it would be
nice to be able to recover it and take a look at what I'm working with...

Regards,

Amine

On Tue, Jan 21, 2020 at 3:55 PM Guyer, Jonathan E. Dr. (Fed) via fipy <
fipy@nist.gov> wrote:

> I'm curious. Do the lines remain dashed on successive calls to plot()?
>
> As to the third question, where are you seeing exponent n and subscript i?
> I'm not suggesting we don't use them, just that I don't know where.
>
> Is the discussion at
>
> https://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#higher-order-diffusion
> helpful?
>
> > On Jan 21, 2020, at 1:25 AM, A A  wrote:
> >
> > Hi Martin,
> >
> > Thanks for your response. That's strange that such a "dummy" command
> would be necessary.
> >
> > I was able to answer the second question myself. It is possible to
> retroactively change line and axis properties. For the mesh1D example I did
> the following:
> >
> > viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
> > ax = viewer.axes
> > ax.lines[-1].set_dashes((3.5,3.5,3.5,3.5))
> > ax.grid()
> > viewer.plot()
> >
> > Which seemed to work quite well.
> >
> > With regards to the third question, I think the terms in the general
> conservation equation are explained reasonably well in the fipy docs,
> except for the diffusion term. It is unclear what the exponent n and
> subscript i represent and how they are related to one another. Is the
> exponent an arithmetic exponent? Is i part of a sum? I had trouble
> expanding the diffusion term to n>=4.
> >
> > Regards,
> >
> > Amine
> >
> > On Mon, Jan 20, 2020 at 5:23 PM Martinus WERTS <
> martinus.we...@ens-rennes.fr> wrote:
> > Dear Amine,
> >
> > Concerning your second question, I think that this a normal (but in this
> case, annoying) feature of the Jupyter notebook.
> >
> > You might trying adding an extra (dummy) command to the cell, after the
> line in which the Viewer() is instantiated. For example: ``print('Ready')``.
> >
> > Best,
> > Martin
> >
> > On 20/01/2020 17:01, A A wrote:
> >> Dear All,
> >>
> >

Re: Some questions on the viewer

2020-01-22 Thread A A
Hi Jonathan,

The lines do remain dashed on successive calls. I guess the viewer keeps
pointing to the right objects even if their properties are retroactively
modified.

Here's what I mean about the diffusion term:

[image: Untitled.png]

On another note, I've posted some stuff on github which may be of interest
regarding the circle diffusion example. I had a hard time visualizing the
mesh so I went with some third-party packages (pyvista, pygmsh) and the
result looks quite nice. https://github.com/usnistgov/fipy/issues/693

I'm now experimenting with cylindrical coordinates as I would like to try
to solve the heat equation in radial terms. I tried repeating the above
procedure to visualize CylindricalGrid1D and CylindricalGrid2D  objects but
without much luck. Here's what I'm doing:

from fipy import Variable, FaceVariable, CellVariable, Grid1D,
CylindricalGrid1D, CylindricalGrid2D, ExplicitDiffusionTerm, TransientTerm,
DiffusionTerm, Viewer
from fipy.tools import numerix
import numpy as np
import pyvista

mesh = CylindricalGrid2D(dr=0.1, dz=0.25, nr=3, nz=0.1)
ugrid= pyvista.UnstructuredGrid(mesh.VTKCellDataSet._vtk_obj)
plotter = pyvista.Plotter()
plotter.set_background('white')
plotter.add_mesh(ugrid, style='wireframe', color='black')
plotter.add_bounding_box(color='red')
plotter.show_grid(color="red")
plotter.view_xy()
plotter.show()

I only get the red bounding box/grid but no cylindrical mesh. Is there
something I'm missing regarding the nature of CylindricalGrid objects? It
seems that fipy is working with/using VTK under the hood so it would be
nice to be able to recover it and take a look at what I'm working with...

Regards,

Amine

On Tue, Jan 21, 2020 at 3:55 PM Guyer, Jonathan E. Dr. (Fed) via fipy <
fipy@nist.gov> wrote:

> I'm curious. Do the lines remain dashed on successive calls to plot()?
>
> As to the third question, where are you seeing exponent n and subscript i?
> I'm not suggesting we don't use them, just that I don't know where.
>
> Is the discussion at
>
> https://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#higher-order-diffusion
> helpful?
>
> > On Jan 21, 2020, at 1:25 AM, A A  wrote:
> >
> > Hi Martin,
> >
> > Thanks for your response. That's strange that such a "dummy" command
> would be necessary.
> >
> > I was able to answer the second question myself. It is possible to
> retroactively change line and axis properties. For the mesh1D example I did
> the following:
> >
> > viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
> > ax = viewer.axes
> > ax.lines[-1].set_dashes((3.5,3.5,3.5,3.5))
> > ax.grid()
> > viewer.plot()
> >
> > Which seemed to work quite well.
> >
> > With regards to the third question, I think the terms in the general
> conservation equation are explained reasonably well in the fipy docs,
> except for the diffusion term. It is unclear what the exponent n and
> subscript i represent and how they are related to one another. Is the
> exponent an arithmetic exponent? Is i part of a sum? I had trouble
> expanding the diffusion term to n>=4.
> >
> > Regards,
> >
> > Amine
> >
> > On Mon, Jan 20, 2020 at 5:23 PM Martinus WERTS <
> martinus.we...@ens-rennes.fr> wrote:
> > Dear Amine,
> >
> > Concerning your second question, I think that this a normal (but in this
> case, annoying) feature of the Jupyter notebook.
> >
> > You might trying adding an extra (dummy) command to the cell, after the
> line in which the Viewer() is instantiated. For example: ``print('Ready')``.
> >
> > Best,
> > Martin
> >
> > On 20/01/2020 17:01, A A wrote:
> >> Dear All,
> >>
> >> I'm just getting back into using fipy after a few months hiatus. I'm
> getting more familiar with how it works, but I have a couple of questions
> about the viewer:
> >>  • Is it possible to control linestyle (specifically dashes)  of
> the cellVariable objects tied to each specific viewer? I'd like to avoid
> the possibility of superimposing very similar plots and thinking they are
> the same
> >>  • I am primarily using jupyter notebook to practice some basic
> concepts. What I've found is that simply instantiating the viewer in
> interactive mode will generate a plot. This renders a viewer.plot() call
> redundant. When I run the whole notebook in non-interactive mode I get the
> expected behavior, namely one plot with a .plot() call. Am I missing
> something here? Why does viewer instantiation generate a plot in jupyter
> notebook?
> >> Thanks for your help and look forward to your reply.
> >>
> >> Regards,
> >>
> >> Amine Aboufirass
> >>
> >>
> >> ___
> >> 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/li

Re: Some questions on the viewer

2020-01-21 Thread Guyer, Jonathan E. Dr. (Fed) via fipy
I'm curious. Do the lines remain dashed on successive calls to plot()?

As to the third question, where are you seeing exponent n and subscript i? I'm 
not suggesting we don't use them, just that I don't know where.

Is the discussion at
https://www.ctcms.nist.gov/fipy/documentation/numerical/discret.html#higher-order-diffusion
helpful?

> On Jan 21, 2020, at 1:25 AM, A A  wrote:
> 
> Hi Martin,
> 
> Thanks for your response. That's strange that such a "dummy" command would be 
> necessary. 
> 
> I was able to answer the second question myself. It is possible to 
> retroactively change line and axis properties. For the mesh1D example I did 
> the following:
> 
> viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
> ax = viewer.axes
> ax.lines[-1].set_dashes((3.5,3.5,3.5,3.5))
> ax.grid()
> viewer.plot()
> 
> Which seemed to work quite well. 
> 
> With regards to the third question, I think the terms in the general 
> conservation equation are explained reasonably well in the fipy docs, except 
> for the diffusion term. It is unclear what the exponent n and subscript i 
> represent and how they are related to one another. Is the exponent an 
> arithmetic exponent? Is i part of a sum? I had trouble expanding the 
> diffusion term to n>=4.
> 
> Regards,
> 
> Amine
> 
> On Mon, Jan 20, 2020 at 5:23 PM Martinus WERTS  
> wrote:
> Dear Amine,
> 
> Concerning your second question, I think that this a normal (but in this 
> case, annoying) feature of the Jupyter notebook. 
> 
> You might trying adding an extra (dummy) command to the cell, after the line 
> in which the Viewer() is instantiated. For example: ``print('Ready')``.
> 
> Best,
> Martin
> 
> On 20/01/2020 17:01, A A wrote:
>> Dear All,
>> 
>> I'm just getting back into using fipy after a few months hiatus. I'm getting 
>> more familiar with how it works, but I have a couple of questions about the 
>> viewer:
>>  • Is it possible to control linestyle (specifically dashes)  of the 
>> cellVariable objects tied to each specific viewer? I'd like to avoid the 
>> possibility of superimposing very similar plots and thinking they are the 
>> same
>>  • I am primarily using jupyter notebook to practice some basic 
>> concepts. What I've found is that simply instantiating the viewer in 
>> interactive mode will generate a plot. This renders a viewer.plot() call 
>> redundant. When I run the whole notebook in non-interactive mode I get the 
>> expected behavior, namely one plot with a .plot() call. Am I missing 
>> something here? Why does viewer instantiation generate a plot in jupyter 
>> notebook?
>> Thanks for your help and look forward to your reply.
>> 
>> Regards,
>> 
>> Amine Aboufirass
>> 
>> 
>> ___
>> 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 ]
> ___
> 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: Some questions on the viewer

2020-01-21 Thread Martinus WERTS
Dear Amine,

In the end, my suggestion does not work... Instantiation of Viewer() in
the Jupyter notebook always generates a spontaneous plot. We will have
to live with it. (I do not know the equivalent of 'silent 1;
pauseupdate" in Python Jupyter notebook).

Also, on first Viewer() instantiation I get a deprecation warning
('set_norm' function will be removed in Matplotlib 3.3), and I have the
impression that there are some quirks with the color legend. But the
Viewer still works great for inspecting variables.

Best
Martin
(Fipy 3.3 conda-forge, Python 3.7, Ubuntu)

On 21/01/2020 07:25, A A wrote:
> Hi Martin,
>
> Thanks for your response. That's strange that such a "dummy" command
> would be necessary. 
>
> I was able to answer the second question myself. It is possible to
> /retroactively /change line and axis properties. For the mesh1D
> example I did the following:
>
> viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
> ax = viewer.axes
> ax.lines[-1].set_dashes((3.5,3.5,3.5,3.5))
> ax.grid()
> viewer.plot()
>
> Which seemed to work quite well. 
>
> With regards to the third question, I think the terms in the general
> conservation equation are explained reasonably well in the fipy docs,
> except for the diffusion term. It is unclear what the exponent n and
> subscript i represent and how they are related to one another. Is the
> exponent an arithmetic exponent? Is i part of a sum? I had trouble
> expanding the diffusion term to n>=4.
>
> Regards,
>
> Amine
>
> On Mon, Jan 20, 2020 at 5:23 PM Martinus WERTS
> mailto:martinus.we...@ens-rennes.fr>>
> wrote:
>
> Dear Amine,
>
> Concerning your second question, I think that this a normal (but
> in this case, annoying) feature of the Jupyter notebook.
>
> You might trying adding an extra (dummy) command to the cell,
> after the line in which the Viewer() is instantiated. For example:
> ``print('Ready')``.
>
> Best,
> Martin
>
> On 20/01/2020 17:01, A A wrote:
>> Dear All,
>>
>> I'm just getting back into using fipy after a few months hiatus.
>> I'm getting more familiar with how it works, but I have a couple
>> of questions about the viewer:
>>
>>   * Is it possible to control linestyle (specifically dashes)  of
>> the cellVariable objects tied to each specific viewer? I'd
>> like to avoid the possibility of superimposing very similar
>> plots and thinking they are the same
>>   * I am primarily using jupyter notebook to practice some basic
>> concepts. What I've found is that simply instantiating the
>> viewer in interactive mode will generate a plot. This renders
>> a viewer.plot() call redundant. When I run the whole notebook
>> in non-interactive mode I get the expected behavior, namely
>> one plot with a .plot() call. Am I missing something here?
>> Why does viewer instantiation generate a plot in jupyter
>> notebook?
>>
>> Thanks for your help and look forward to your reply.
>>
>> Regards,
>>
>> Amine Aboufirass
>>
>> ___
>> 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 ]
>
>
> ___
> 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: Some questions on the viewer

2020-01-20 Thread A A
Hi Martin,

Thanks for your response. That's strange that such a "dummy" command would
be necessary.

I was able to answer the second question myself. It is possible to
*retroactively
*change line and axis properties. For the mesh1D example I did the
following:

viewer = Viewer(vars=(phi, phi_analytical), datamin=-6.0, datamax=6.0)
ax = viewer.axes
ax.lines[-1].set_dashes((3.5,3.5,3.5,3.5))
ax.grid()
viewer.plot()

Which seemed to work quite well.

With regards to the third question, I think the terms in the general
conservation equation are explained reasonably well in the fipy docs,
except for the diffusion term. It is unclear what the exponent n and
subscript i represent and how they are related to one another. Is the
exponent an arithmetic exponent? Is i part of a sum? I had trouble
expanding the diffusion term to n>=4.

Regards,

Amine

On Mon, Jan 20, 2020 at 5:23 PM Martinus WERTS 
wrote:

> Dear Amine,
>
> Concerning your second question, I think that this a normal (but in this
> case, annoying) feature of the Jupyter notebook.
>
> You might trying adding an extra (dummy) command to the cell, after the
> line in which the Viewer() is instantiated. For example: ``print('Ready')``.
>
> Best,
> Martin
>
> On 20/01/2020 17:01, A A wrote:
>
> Dear All,
>
> I'm just getting back into using fipy after a few months hiatus. I'm
> getting more familiar with how it works, but I have a couple of questions
> about the viewer:
>
>- Is it possible to control linestyle (specifically dashes)  of the
>cellVariable objects tied to each specific viewer? I'd like to avoid the
>possibility of superimposing very similar plots and thinking they are the
>same
>- I am primarily using jupyter notebook to practice some basic
>concepts. What I've found is that simply instantiating the viewer in
>interactive mode will generate a plot. This renders a viewer.plot() call
>redundant. When I run the whole notebook in non-interactive mode I get the
>expected behavior, namely one plot with a .plot() call. Am I missing
>something here? Why does viewer instantiation generate a plot in jupyter
>notebook?
>
> Thanks for your help and look forward to your reply.
>
> Regards,
>
> Amine Aboufirass
>
> ___
> fipy mailing listfipy@nist.govhttp://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 ]
>
___
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


Re: Some questions on the viewer

2020-01-20 Thread Martinus WERTS
Dear Amine,

Concerning your second question, I think that this a normal (but in this
case, annoying) feature of the Jupyter notebook.

You might trying adding an extra (dummy) command to the cell, after the
line in which the Viewer() is instantiated. For example: ``print('Ready')``.

Best,
Martin

On 20/01/2020 17:01, A A wrote:
> Dear All,
>
> I'm just getting back into using fipy after a few months hiatus. I'm
> getting more familiar with how it works, but I have a couple of
> questions about the viewer:
>
>   * Is it possible to control linestyle (specifically dashes)  of the
> cellVariable objects tied to each specific viewer? I'd like to
> avoid the possibility of superimposing very similar plots and
> thinking they are the same
>   * I am primarily using jupyter notebook to practice some basic
> concepts. What I've found is that simply instantiating the viewer
> in interactive mode will generate a plot. This renders a
> viewer.plot() call redundant. When I run the whole notebook in
> non-interactive mode I get the expected behavior, namely one plot
> with a .plot() call. Am I missing something here? Why does viewer
> instantiation generate a plot in jupyter notebook?
>
> Thanks for your help and look forward to your reply.
>
> Regards,
>
> Amine Aboufirass
>
> ___
> 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 ]


Fwd: Some questions on the viewer

2020-01-20 Thread A A
I'd like to add a third question to the below, but which is not related to
the viewer:

   - Does a reference document/publication exist for the general
   conservation equation as solved by fipy? I am looking for something which
   defines the terms in said equation with slightly more mathematical
   rigour... Thanks!


-- Forwarded message -
From: A A 
Date: Mon, Jan 20, 2020 at 5:01 PM
Subject: Some questions on the viewer
To: 


Dear All,

I'm just getting back into using fipy after a few months hiatus. I'm
getting more familiar with how it works, but I have a couple of questions
about the viewer:

   - Is it possible to control linestyle (specifically dashes)  of the
   cellVariable objects tied to each specific viewer? I'd like to avoid the
   possibility of superimposing very similar plots and thinking they are the
   same
   - I am primarily using jupyter notebook to practice some basic concepts.
   What I've found is that simply instantiating the viewer in interactive mode
   will generate a plot. This renders a viewer.plot() call redundant. When I
   run the whole notebook in non-interactive mode I get the expected behavior,
   namely one plot with a .plot() call. Am I missing something here? Why does
   viewer instantiation generate a plot in jupyter notebook?

Thanks for your help and look forward to your reply.

Regards,

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


Some questions on the viewer

2020-01-20 Thread A A
Dear All,

I'm just getting back into using fipy after a few months hiatus. I'm
getting more familiar with how it works, but I have a couple of questions
about the viewer:

   - Is it possible to control linestyle (specifically dashes)  of the
   cellVariable objects tied to each specific viewer? I'd like to avoid the
   possibility of superimposing very similar plots and thinking they are the
   same
   - I am primarily using jupyter notebook to practice some basic concepts.
   What I've found is that simply instantiating the viewer in interactive mode
   will generate a plot. This renders a viewer.plot() call redundant. When I
   run the whole notebook in non-interactive mode I get the expected behavior,
   namely one plot with a .plot() call. Am I missing something here? Why does
   viewer instantiation generate a plot in jupyter notebook?

Thanks for your help and look forward to your reply.

Regards,

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