On Oct 4, 2006, at 4:04 PM, Jonathan Guyer wrote:



On Oct 4, 2006, at 3:22 PM, hzhatlboro wrote:

On 04/10/2006 19:01 Jonathan Guyer wrote the following:
On Oct 4, 2006, at 12:51 PM, hzhatlboro wrote:
Hi, could someone help why I did not get the initial condition that I want as specified in the attached PDF file?  The code I used as below.  Thanks for your time!  hzh
It looks right to me. What's the problem?
I am not sure what kind of result was displayed on your computer.

The result I see with the gist viewer is exactly what's shown in your schematic (page 1 of 2), rather than what's in your graph (page 2 of 2). I've printed out the values with the TSVViewer just to be sure. Therefore, what you're seeing are display glitches with the matplotlib viewer, not problems with the initial conditions you are setting.

The problem is in fipy/viewers/matplotlibViewer/matplotlibGrid2DViewer. As far as I can tell it is line 111, it is:

    >>> return reshape(array(self.vars[0]), self.vars[0].getMesh().getShape())

it should be:

    >>> return reshape(array(self.vars[0]), self.vars[0].getMesh().getShape()[::-1])

to reverse the axis. Things seem to display nicely with that fix.

Jon, shall I go ahead and fix this on trunk and branch-version-1_1?

hzhatlboro, You can explicitly use a different viewer to get around this problem.
One choice, replace:

   >>> from fipy.viewers import make
   >>> viewer = make(vars=c, limits={'datamin':0., 'datamax':1.})

with:

   >>> from fipy.viewers.matplotlibViewer.matplotlib2DViewer import Matplotlib2DViewer
   >>> viewer = Matplotlib2DViewer(vars=c, limits={'datamin':0., 'datamax':1.})

in your script.

Hope this helps. Thanks for your feedback, it is very useful.



The picture I got from the code is in the PDF file as attached.  I have three questions with respect to this result:-
Q1: The concentrations in A1 and A2 are set the wrong way.  Area A1 should be Calpha0, and Area A2 should be Cliq0.
The actual values are correct. I don't know why matplotlib is displaying them wrong.
Q2: The concentrations in Area A3 and A4 should be homogeneous, but they are obviously not.
By homogeneous, I assume that you mean that A3 and A4 should have the same value. If you use a different viewer or print out the values, you'll see that they do have the same value, so this is another display glitch.
Q3: Even in Area A3, the concentration seems not homogenous, why does this happen?
matplotlib tries to be helpful and smoothes the transitions between different color regions. With finer resolutions, this isn't that noticeable and actually produces better looking graphics, but it's clearly deceptive here. We'll look into a way to turn it off.


We will investigate what's going wrong with matplotlib. I do see the same thing here.


--

Daniel Wheeler



Reply via email to