On Jan 17, 2007, at 4:12 PM, Matt Koch wrote:
Hi Daniel,
and thanks for your quick response. Here is my response in return:
1) Installation
I used Enthought's Pyhon 2.4 and the straight downloads of
PyVTK-0.47 (?) and FiPy-1.1 from your web site to install on
Windows 2000. I also added PySparse-0.34.
Somehow, I can't shake the feeling that the whole thing is quite
unstable - the system seems to lock up on many of the example
problems, but then again, I just realized that may be because
calculations are running in the background which make the Phython
interface freeze up. Plus, I only have 512 MB of memory on a AMD XP
1700+.
The IDLE interface is forever locking up on me too. This could be
more to do with my machine, but I am not sure.
I don't use Windows very much. Mostly I just check that thinks work
on Windows and leave it at that. I have thought about recommending a
better IDE on Windows, but haven't got round to checking any. IDLE
comes with enthought python
so it seems like the obvious choice. I know that ipython has been
used effectively on Windows. You may want to look into this:
<http://ipython.scipy.org/moin/FrontPage>
<http://showmedo.com/videos/series?name=PythonIPythonSeries>
Also, there seem to be dozens of IDEs for python <http://
wiki.python.org/moin/IntegratedDevelopmentEnvironments>.
On Slackware 10.2 Linux, I downloaded all the "tar.gz" packages
from various places (it comes with Python 2.4 pre-installed) and
used the "python setup.py build" and/or "python setup.py install"
procedures. The matplotlib-0.87 (?) library seems to contain a
bug, so I had to SVN that one. After that, it seems to work. I did
not put MayaVI on yet, but I might, just to compare Windows 2000
and Linux on a one on one basis.
I wouldn't bother with Mayavi unless you find that you need it for
some reason. We may well stop supporting it soon as
it has become outdated and matplotlib is fairly ubiquitous in teh
scientific python community now as well as possibly
getting support for 3D.
2) Wedge-Shaped Mesh
Is there a document where I can read up on this?
No. We have no examples as yet.
I just have no concept of why I would need a 3D mesh to generate a
2D cylindrical mesh.
This is so that the cell volumes and face areas are approximated
correctly. You could of course
subclass from Grid2D to make a CylindricalGrid2D object and overwrite
the methods required to
create cell volumes and face areas. I am not sure if this is all you
have to do, but I suspect it is.
Do I need a 3D mesh to generate a 2D rectangular mesh as well?
No. 2D mesh objects are really 2D. The reason you would have to do it
in the case of cylindrical coordinates
it to avoid making changes to the discretization of the equations. I
believe (needs to be confirmed) that changing the
cell volumes and face areas does in fact allow you to use cartesian
discretization with cylindrical coordinates.
As far as my approach, while I like GMsh a lot, if I can get done
what I need to get done in FiPy, all the better. So, perhaps you
can provide some assistance with a 2D cylindrical mesh generated in
FiPy alone?
We will probably do this at some stage and it may not be such a big
job, but I can't do it right now.
The stages for doing this are as follows.
1) Create class CylindricalGird2D subclassed from UniformGrid2D.
2) Overwrite getCellVolumes(), getFaceAreas() to have the
correct values.
3) Write some test cases.
By "wedge-shaped", do you mean as in a slice of pie?
Exactly.
3) Tee Geometry
Thanks for the tip. I recall now having stumbled across this
somewhere in the documentation. I assume the "shift and merge"
trick somehow applies to the above cylindrical mesh as well?
Yes, that works in 3D and would work if you created a
CylindricalGrid2D object as well.
Cheers
Best Regards,
Matt Koch
Daniel Wheeler wrote:
Hi Matt,
Thanks for your interest. I'll try and answer your questions below.
On Jan 16, 2007, at 11:23 PM, Matt Koch wrote:
Hello there,
I am brand new new FiPy, in fact just seem to have managed to
install it on Windows 2000 and Slackware 10.2 Linux.
Good. Did you use subversion to get the latest version of fipy or
did you install 1.1?
This seems like enormously powerful software! I have read some
documentation and briefly reviewed the mailing list. There is one
entry (http://www.mail-archive.com/fipy@nist.gov/msg00116.html)
that seems to speak to the subject, but it is a little too
advanced for me.
This exchange discusses wedge shaped meshes that are a requirement
for faking cylindrical coordinates using
Cartesian discretization. If you want to solve a 2D cylindrical
problem, you need to create a 3D wedge shaped mesh.
This may be possible in gmsh and then you can use the Gmsh
importer to read the mesh and run it in fipy. We can discuss this
further if this is what you decide on doing. You may also be able
to bury the cylindrical prefactors inside the term's coefficient.
I would have to look more closely at your equations.
I am just wondering how to set up a problem in cylindrical (r,z)
rather than rectangular (x,y) coordinates. Is there a command I
should call or is there an object I have to initialize in order
to switch on cylindrical coordinates? From the above entry, I am
almost guessing that one would have to implement their own
divergences and such in cylindrical coordinates by adding the
radius in proper places of the divergences and such in
rectangular coordinates? That can't be right!?
The wedge shaped mesh will take care of this, although there is
some loss of accuracy. I have never measured the error,
but I have been informed that this is an acceptable method. I
think refactoring the discretization and various gradient operators
for cylindrical coordinates would be quite an involved process at
this point and I wouldn't recommend it.
Also, other than using GMsh (which is incredibly awesome
software, by the way), how I can I create somewhat more
complicated domains than the simple lines, squares and circles
used in most of the examples. Can I generate such geometry in
FiPy, and can I mesh that then? All I have seen thus far is
meshing commands for lines, rectangles or circles. How would I
create and mesh, say, a Tee shape?
You can splice meshes in fipy, which is more straightforward than
using gmsh for some problems.
To create a T mesh, you need just create two rectangular meshes
and add them together as below. Remember the
vertices and faces have to be perfectly aligned and not overlapping
>>> from fipy import *
>>> mesh1 = Grid2D(nx=6, ny=2) + (-3.0, 6.0)
>>> mesh2 = Grid2D(nx=2, ny=6)
>>> mesh = mesh1 + mesh2
>>> print mesh.getCellCenters()
[[-2.5 6.5]
[-1.5 6.5]
[-0.5 6.5]
[ 0.5 6.5]
[ 1.5 6.5]
[ 2.5 6.5]
[-2.5 7.5]
[-1.5 7.5]
[-0.5 7.5]
[ 0.5 7.5]
[ 1.5 7.5]
[ 2.5 7.5]
[ 0.5 0.5]
[ 1.5 0.5]
[ 0.5 1.5]
[ 1.5 1.5]
[ 0.5 2.5]
[ 1.5 2.5]
[ 0.5 3.5]
[ 1.5 3.5]
[ 0.5 4.5]
[ 1.5 4.5]
[ 0.5 5.5]
[ 1.5 5.5]]
Thanks,
Matt Koch
Cheers
--
Daniel Wheeler
--
Daniel Wheeler