[Paraview] question-filter

Cory Quammen cory.quammen at kitware.com
Sat Mar 19 18:15:22 EDT 2016


Islem,

The dot "." in the array name is causing problems. Because it is a Python
expression, the interpreter thinks you are asking for an attribute "water"
from a class or module.

Can you try the expression

sum(inputs[0].PointData['alpha.water']*volume(inputs[0]))

That works in an example I've created locally.

Cory

On Wed, Mar 16, 2016 at 9:03 PM, Megdich Islem <megdich_islem at yahoo.fr>
wrote:

> Hey Cory,
>
> I tried the expression sum(alpha*volume(input)), I got an error saying
> that alpha is not defined. I changed the expression to
> sum(alpha.water*volume(input)) because the water fraction  is written in
> file alpha.water but again I got the same errors. You find attached
> snapshots that illustrate that.
>
> Regards,
> Islem
>
>
> Le Mercredi 16 mars 2016 14h29, Cory Quammen <cory.quammen at kitware.com> a
> écrit :
>
>
> Yes!
>
> Assuming your cell fraction is cell data named "alpha", use the following
> expression in your annotation filter:
>
> sum(alpha*volume(input))
>
> Make sure you set the Array Association property to Cell Data.
>
> Let me know if that works or not.
>
> Thanks,
> Cory
>
> On Wed, Mar 16, 2016 at 8:56 AM, Megdich Islem <megdich_islem at yahoo.fr>
> wrote:
>
> Hey Cory,
>
> Thank you for your email. Can I get some hints about how can I multiply
> each cell volume with  the water fraction.
>
> Regards,
> Islem Megdiche
> PhD student
>
>
> Le Mercredi 16 mars 2016 12h38, Cory Quammen <cory.quammen at kitware.com> a
> écrit :
>
>
> Islem,
>
> Thanks for reporting back which worked. I'm not sure why the expression
> without the "algs." doesn't work - in any case, I'm glad it is working for
> you now.
>
> The "inputs[0]" simply means the first element in the inputs list. The
> index lets you pick the input (there can be more than one). You could also
> simply use "input", which gives you the same element as "inputs[0]".
>
> Cory
>
> On Tue, Mar 15, 2016 at 7:01 AM, Megdich Islem <megdich_islem at yahoo.fr>
> wrote:
>
> Hi Cory,
>
> Thank you for your email. I tried that example sphere source -> Delaunay3D
> -> Python Annotation filter and it works fine. I set the python expression
> to  algs.sum(algs.volume(inputs[0])) and then to sum(volume(inputs[0]))
> and it works in both cases.
> The type from the information panel is Table.
>
> But, it turns out that for my case the problem is with the Python
> expression, when I use this expression algs.sum(algs.volume(inputs[0])) I
> get errors while this expression sum(volume(inputs[0])) solves the problem.
> The type from the information panel is Table.
>
> Can I ask what does inputs[0] mean in the python expression. I have no
> background in python, that's why the expression seems odd to me.
>
> Regards,
> Islem Megdiche
>
>
> Le Lundi 14 mars 2016 15h04, Cory Quammen <cory.quammen at kitware.com> a
> écrit :
>
>
> One more thing: you should be able to change the Python expression to
>
> sum(volume(inputs[0]))
>
> On Mon, Mar 14, 2016 at 10:09 AM, Cory Quammen <cory.quammen at kitware.com>
> wrote:
>
> Hi Islem,
>
> Sorry for the late reply. I've been swamped lately.
>
> Thank you for the detailed explanation of what you are doing. That really
> helps us narrow down what might be going on.
>
> I'm not sure what the problem is. I have a simple pipeline example where
> this works:
>
> Sphere source -> Delaunay3D -> Python Annotation filter
>
> The Delaunay3D filter produces an unstructured grid, from which I am able
> to get the volumes.
>
> I suspect ParaView readds your OpenFOAM data set as a multiblock data set?
> Could you look at the Info panel and report it's Type. It should be the
> first item under the "Statistics" sub-section.
>
> If it is indeed a multiblock data set, please try this:
>
> Place a MergeBlocks filter between your Threshold filter and Python
> Annotation filter.
>
> Please see if that works. If it does, we'll move on to multiplying the
> volume by the water fraction.
>
> Thanks,
> Cory
>
> On Tue, Mar 8, 2016 at 6:35 AM, Megdich Islem <megdich_islem at yahoo.fr>
> wrote:
>
> Hi cory,
>
> I was working on the case of water computation in the desired domain
> taking into account your suggestions. I attached here some pictures that
> helps to figure out how I did it. I created the domain in which I want to
> compute the volume of water using the clip filter and then I thresolded the
> clipped domain to  contain only the cells ranging between 0.5 and 1 of
> alpha water and I ended up with the domain illustrated in picture 3, and
> then I applied the annotation filter setting up the array association to
> Point Data and the expression to algs.sum(algs.volume(inputs[0])), but I
> ended up with an error in the render view and output message stating that
> AttributeError:'None Type' object has no attribute 'GetCellData'. I
> couldn't understand the reason, I tried  all the array Association options,
> I got the same error, except for the Row Data, I got this error:
> AttributeError:'NoneType' object has no attribute 'GetNumberOfArrays'.
> (picture 4 and 5).
>
> I googled that link
>
> paraview.simple.PythonAnnotation — ParaView/Python 5.0.1-RC1-193-gad11756
> documentation
> <http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html>
>
>
>
>
>
>
>
> paraview.simple.PythonAnnotation — ParaView/Python 5.0.1-RC1-193-gad11756
> documentation
> <http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html>
> Docs » Index paraview.simple.PythonAnnotation
> paraview.simple.PythonAnnotation paraview.simple.PythonAnnotation(*input,
> **params) This filter uses Python to calculate an expression. It
> Afficher sur *www.paraview.org*
> <http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html>
> Aperçu par Yahoo
>
>
> It  says that I need to set the input which I didn't know how to do it
> since it doesn't ask for any input in the Properties Panel. Any solutions
> for this problem ??
>
> In this expression algs.sum(algs.volume(inputs[*0*])), what does the *0 * stands
> for ?
>
> I think if I threshold the domain in which I want to calculate the volume
> of water, let's say between 0.5 and 1, then I will end up by inaccurate
> water volume because I am including volume of air in the computed volume
> and on the other hand I am ignoring the cells that contain less than 0.5 of
> water.
>
> That's why, I am looking for an algorithm that multiply every cell
> containing water by the coefficient alpha water. You find attached in
> picture 6, an example of how I want to calculate the water volume. I don't
> know how to program it.
>
> Any helps concerning this matter will be very much appreciated.
> Regards,
> Islem Megdiche
> PhD student
>
>
> Le Mardi 23 février 2016 14h21, Cory Quammen <cory.quammen at kitware.com> a
> écrit :
>
>
> Hi Islem,
>
> Please reply-all to keep the discussion on the list so that others may
> benefit from the discussion.
>
> First, is there a data array that describes whether a volume element
> in your mesh contains water or some other element? If so, you can use
> the Threshold filter under the Filters -> Alphabetical -> Threshold
> menu to select only the elements representing water. You will have to
> set the minimum and maximum to the value that represents water, then
> click Apply.
>
> HTH,
> Cory
>
> On Mon, Feb 22, 2016 at 1:14 PM, Megdich Islem <megdich_islem at yahoo.fr>
> wrote:
> > Hi again,
> >
> > Thank you for your suggestion, Could you please explain how to do the
> first
> > step because I am not the one who created the picture I sent you before.
> >
> > Regards,
> > Islem
> >
> >
> > Le Lundi 22 février 2016 16h45, Megdich Islem <megdich_islem at yahoo.fr> a
> > écrit :
> >
> >
> > Thank you for your reply. I will try your suggestions.
> >
> > Regards,
> > Islem
> >
> >
> > Le Lundi 22 février 2016 14h22, Cory Quammen <cory.quammen at kitware.com>
> a
> > écrit :
> >
> >
> > Islem,
> >
> > There are likely two steps:
> >
> > 1). Threshold your volume to identify only the water-containing cells.
> > It looks like you have a way to do this already?
> >
> > 2). Compute the volumes of the water-containing cells and summing them
> up.
> >
> > You can use the Threshold filter to do number 1 if you have a material
> > code in the cell data. To compute the volume of the cells, add a
> > Python Annotation filter to the Threshold filter. Set the Expression
> > to
> >
> > algs.sum(algs.volume(inputs[0]))
> >
> > This uses the numpy-like interface in the Python layer to compute the
> > volumes of the cells and sum them all up. The Python Annotation filter
> > should display the volume with a text label in your renderer.
> >
> > Hope this helps,
> > Cory
> >
> > On Mon, Feb 22, 2016 at 9:09 AM, Megdich Islem <megdich_islem at yahoo.fr>
> > wrote:
> >> Hi Cory,
> >>
> >> Thank you very much for your prompt reply. I've attached here a picture
> >> that
> >> illustrates my problem. I am working on the break of bund walls and I
> want
> >> to compute the volume of water that overtops the bund wall (walls
> >> surrounding storage tank), after the  solution reaches the steady state.
> >>
> >> Regards,
> >> Islem
> >>
> >>
> >> Le Lundi 22 février 2016 13h53, Cory Quammen <cory.quammen at kitware.com>
> a
> >> écrit :
> >>
> >>
> >> Hi Islem,
> >>
> >> This is the place to ask ParaView questions! There is some activity on
> >> StackOverflow, but most people ask questions on this mailing list.
> >>
> >> Could you clarify what you want to compute? Do you just want to subset
> >> a volume mesh and display the results over time? Do you want to
> >> compute one quantity and display it as a graph over time? Do you want
> >> to compute a single number from a time series data set?
> >>
> >> Thanks,
> >> Cory
> >>
> >> On Mon, Feb 22, 2016 at 8:48 AM, Megdich Islem <megdich_islem at yahoo.fr>
> >> wrote:
> >>> Hello,
> >>>
> >>> I am new to paraview, and I didn't find a forum under paraview website
> to
> >>> ask my question.
> >>> My question is is there any filter in paraview that lets to compute the
> >>> evolution of a quantity within a specific volume of the mesh.
> >>>
> >>> Regards,
> >>> Islem
> >>>
> >>> _______________________________________________
> >>> Powered by www.kitware.com
> >>>
> >>> Visit other Kitware open-source projects at
> >>> http://www.kitware.com/opensource/opensource.html
> >>>
> >>> Please keep messages on-topic and check the ParaView Wiki at:
> >>> http://paraview.org/Wiki/ParaView
> >>>
> >>> Search the list archives at: http://markmail.org/search/?q=ParaView
> >>>
> >>> Follow this link to subscribe/unsubscribe:
> >>> http://public.kitware.com/mailman/listinfo/paraview
> >>
> >>>
> >>
> >>
> >>
> >> --
> >> Cory Quammen
> >> R&D Engineer
> >> Kitware, Inc.
>
> >
> >>
> >>
> >>
> >
> >
> >
> > --
> > Cory Quammen
> > R&D Engineer
> > Kitware, Inc.
> >
> >
> >
> >
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>
>


-- 
Cory Quammen
R&D Engineer
Kitware, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20160319/3d43d04f/attachment.html>


More information about the ParaView mailing list