Hi Daniel,

On 2013-01-02 16:17, Daniel Wheeler wrote:
> On Mon, Dec 31, 2012 at 10:04 AM, Stefan Schwarzer <sschwarzer@sschwarzer
> .net> wrote:
>> RuntimeWarning: invalid value encountered in double_scalars if
>>   (numerix.sqrt(numerix.sum(errorVector**2)) / error0) <= self.tolerance
> 
> I don't get the above warning. Which version of FiPy are you using and
> which solver?

FiPy 3.0 with the SciPy solver. Versions are SciPy 0.10.1
and NumPy 1.6.2 in case it matters.

>> Now I want to set different initial concentration values for
>> different mesh points. How do I do this?
> 
> If you want to set values based on position, then use "mesh.cellCenters" or
> "mesh.x" and "mesh.y" to get the position of each cell. The ordering
> corresponds to the ordering for CellVariable values (as suggested by Salomen
> )

Yes, that looks good. :-) Thanks, Salomon! :-)

>> By reading some of the FiPy code in `meshVariable.py`, I
>> found out that I can pass an array as the `value` argument
>> of the `CellVariable` constructor, like this:
> 
> You can do this, but you have no idea how the CellVariable values
> correspond to position. There is no particular ordering of values in
> FiPybase on geometric position.

Maybe there should be something in the docs what the
semantics of the `rank` and `elementShape` are.

>>   def test():
>>       # Set up problem.
>>       mesh = fipy.Grid2D(dx=1.0, dy=1.0, nx=10, ny=10)
>>       initial_value = fipy.numerix.zeros((10, 10))
>>       initial_value[:3, :3] = 5
> 
> CellVariables are flat arrays as far as geometry is concerned. The last
> index of a CellVariable always corresponds to the number of cells in the
> mesh.

Thanks for the clarification.

> Won't work either. Try using Salomen's example. Does that meet your needs?

Yes, that looks fine.

>> P. S.: I just found
>>
>>   http://article.gmane.org/gmane.comp.python.fipy/2803
>>
>> Is this the answer to my question?
> 
> This just assigns random values independent of location.

I didn't mean it literally; I didn't want to use the random
values. ;-)

> It is also
> concerned with interpolating between grids that are not necessarily
> aligned.

Yes, I was assuming that. In my case setting mesh values
directly, without interpolation, will most likely do it.

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

Reply via email to