On Aug 18, 2008, at 10:16 AM, Rashmi Ranjan Mohanty wrote:
I was wondering if I could plot the average flux in a 2D system. I
mean something like the way we plot average composition or volume
fraction by taking slices of width N*dx across the system and
calculating volume fraction in each such slices. I did such things
by using 'mask' in the past for composition but could not do it for
flux. Doing obvious mistake somewhere, may be something to do with
cellVariable/gacevariable etc.. Is there any way?
You're right. Our vector variables don't support
`getCellVolumeAverage()` (actually, on trunk/ the call doesn't fail,
but the answer is meaningless).
It looks like you can calculate the average vector components like
this, though:
>>> xave = vec.dot((1,0)).getCellVolumeAverage()
>>> yave = vec.dot((0,1)).getCellVolumeAverage()
You can the average magnitude (which is not the magnitude of the
average vector) with:
>>> magave = vec.getMag().getCellVolumeAverage()
You'll want to normalize the values to the masked area, like we
discussed in http://thread.gmane.org/gmane.comp.python.fipy/854