I hope I understand your comment correctly -  If you have a cell variable named 
"field"
you can use field.value to return a numpy array.  You can then set the values 
using numpy 
broadcasting or boolean indexing...

from one of my codes (where I have a list of CellVariables called "varrs", e.g. 
varrs = [grain1, grain2, grain3]

varrs[0].value = 0.0
varrs[0].value[x<length/4.0] = 1.0

where x is another numpy array of x values so that the masking works...

Anyone else want to weigh in on this?  If this is unclear - I can try and give 
a quick snippet
in a ipynb...



On Sep 1, 2015, at 11:09 AM, vahid ettehadi <[email protected]> wrote:

> Hi FiPy users,
> 
> In my problem, I need to export the CellVariable values to a numpy array to 
> do some simple math on each of them and then import them back to the mesh as 
> CellVaribale. I tried to find a function or a example similar to my problem 
> but I couldn't find anything similar. I was wondering is there a function for 
> this purpose or I need write a code on my own? Thanks in advance
> 
> Vahid,
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]


_______________________________________________
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