<div dir="ltr">Islem,<div><br></div><div>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.</div><div><br></div><div>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]".</div><div><br></div><div>Cory</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 15, 2016 at 7:01 AM, Megdich Islem <span dir="ltr"><<a href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:verdana,helvetica,sans-serif;font-size:16px"><div><span>Hi Cory,</span></div><div><span><br></span></div><div dir="ltr"><span>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 </span>sum(volume(inputs[0])) and it works in both cases. </div><div dir="ltr">The type from the information panel is Table.</div><div dir="ltr"><br></div><div dir="ltr">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.</div><div dir="ltr"><br></div><div dir="ltr">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.</div><div dir="ltr"><br></div><div dir="ltr">Regards,</div><div dir="ltr">Islem Megdiche</div><div><div class="h5"> <div><br><br></div><div style="display:block"> <div style="font-family:verdana,helvetica,sans-serif;font-size:16px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"> <div dir="ltr"><font size="2" face="Arial"> Le Lundi 14 mars 2016 15h04, Cory Quammen <<a href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> a écrit :<br></font></div> <br><br> <div><div><div><div dir="ltr">One more thing: you should be able to change the Python expression to<div><br clear="none"></div><div>sum(volume(inputs[0]))</div></div><div><br clear="none"><div><div>On Mon, Mar 14, 2016 at 10:09 AM, Cory Quammen <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>></span> wrote:<br clear="none"><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Islem,<div><br clear="none"></div><div>Sorry for the late reply. I've been swamped lately.</div><div><br clear="none"></div><div>Thank you for the detailed explanation of what you are doing. That really helps us narrow down what might be going on.</div><div><br clear="none"></div><div>I'm not sure what the problem is. I have a simple pipeline example where this works:</div><div><br clear="none"></div><div>Sphere source -> Delaunay3D -> Python Annotation filter</div><div><br clear="none"></div><div>The Delaunay3D filter produces an unstructured grid, from which I am able to get the volumes.</div><div><br clear="none"></div><div>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.</div><div><br clear="none"></div><div>If it is indeed a multiblock data set, please try this:</div><div><br clear="none"></div><div>Place a MergeBlocks filter between your Threshold filter and Python Annotation filter.</div><div><br clear="none"></div><div>Please see if that works. If it does, we'll move on to multiplying the volume by the water fraction.</div><div><br clear="none"></div><div>Thanks,</div><div>Cory</div></div><div><div><div><br clear="none"><div>On Tue, Mar 8, 2016 at 6:35 AM, Megdich Islem <span dir="ltr"><<a rel="nofollow" shape="rect" href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>></span> wrote:<br clear="none"><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:verdana,helvetica,sans-serif;font-size:16px"><div><div><div style="color:#000;background-color:#fff;font-family:verdana,helvetica,sans-serif;font-size:16px"><div><div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">Hi cory,<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">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'.<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">(picture 4 and 5).<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">I googled that link <u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin-bottom:0.0001pt"><span style="font-size:12pt;font-family:Verdana,sans-serif"><a rel="nofollow" shape="rect" href="http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html" target="_blank">paraview.simple.PythonAnnotation — ParaView/Python
5.0.1-RC1-193-gad11756 documentation</a><br clear="none">
<br clear="none">
<u></u><u></u></span></div>
<table border="1" cellspacing="0" cellpadding="0" width="450" style="width:337.5pt;border-collapse:collapse"><tbody><tr style="min-height:.75pt"><td colspan="7" rowspan="1" style="background:#e5e5e5;padding:0cm 0cm 0cm 0cm;min-height:.75pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:1.0pt"> <u></u><u></u></span></div>
</td></tr><tr style="min-height:4.5pt"><td colspan="1" rowspan="5" width="1" style="width:.75pt;background:#e5e5e5;padding:0cm 0cm 0cm 0cm;min-height:4.5pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:1.0pt"> <u></u><u></u></span></div>
</td><td colspan="1" rowspan="5" width="14" style="width:10.5pt;padding:0cm;min-height:4.5pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:14.0pt"> <u></u><u></u></span></div>
</td><td colspan="2" rowspan="1" style="padding:0cm;min-height:4.5pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:6.0pt"> <u></u><u></u></span></div>
</td><td colspan="1" rowspan="5" width="20" style="width:15pt;padding:0cm;min-height:4.5pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:20.0pt"> <u></u><u></u></span></div>
</td><td colspan="1" rowspan="5" width="1" style="width:.75pt;background:#e5e5e5;padding:0cm 0cm 0cm 0cm;min-height:4.5pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:1.0pt"> <u></u><u></u></span></div>
</td><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm;min-height:4.5pt"></td></tr><tr><td colspan="2" rowspan="1" width="454" style="width:340.5pt;padding:0cm 0cm 0cm 0cm">
<div style="margin-bottom:0.0001pt;line-height:12.4pt"><span style="font-size:12.0pt"><a rel="nofollow" shape="rect" href="http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html" target="_blank"><span style="font-size:13.5pt;color:black">paraview.simple.PythonAnnotation —
ParaView/Python 5.0.1-RC1-193-gad11756 documentation</span></a><u></u><u></u></span></div>
<div style="margin-bottom:0.0001pt;line-height:15pt"><span style="font-size:10.0pt">Docs » Index
paraview.simple.PythonAnnotation paraview.simple.PythonAnnotation
paraview.simple.PythonAnnotation(*input, **params) This filter uses Python to
calculate an expression. It<u></u><u></u></span></div>
</td><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm"></td></tr><tr style="min-height:4.5pt"><td colspan="2" rowspan="1" style="padding:0cm;min-height:4.5pt"></td><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm;min-height:4.5pt"></td></tr><tr><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm">
<div style="margin-bottom:0.0001pt"><span style="font-size:1.0pt"><a rel="nofollow" shape="rect" href="http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.PythonAnnotation.html" target="_blank"><span lang="FR" style="font-size:7.0pt;color:#999999">Afficher sur <b>www.paraview.org</b></span></a></span><span lang="FR" style="font-size:1.0pt"><u></u><u></u></span></div>
</td><td colspan="1" rowspan="1" width="100" style="width:75.0pt;padding:0cm 0cm 0cm 0cm">
<div align="right" style="margin-bottom:0cm;margin-bottom:.0001pt;text-align:right;line-height:8.25pt"><span style="font-size:7.0pt">Aperçu
par Yahoo</span><span style="font-size:1.0pt"><u></u><u></u></span></div>
</td><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm"></td></tr><tr style="min-height:6.75pt"><td colspan="2" rowspan="1" style="padding:0cm;min-height:6.75pt"></td><td colspan="1" rowspan="1" style="padding:0cm 0cm 0cm 0cm;min-height:6.75pt"></td></tr><tr style="min-height:.75pt"><td colspan="7" rowspan="1" style="background:#e5e5e5;padding:0cm 0cm 0cm 0cm;min-height:.75pt">
<div style="margin-bottom:0.0001pt"><span style="font-size:1.0pt"> <u></u><u></u></span></div>
</td></tr><tr height="0"><td colspan="1" rowspan="1" width="1" style="border:none"></td><td colspan="1" rowspan="1" width="14" style="border:none"></td><td colspan="1" rowspan="1" width="220" style="border:none"></td><td colspan="1" rowspan="1" width="194" style="border:none"></td><td colspan="1" rowspan="1" width="20" style="border:none"></td><td colspan="1" rowspan="1" width="1" style="border:none"></td><td colspan="1" rowspan="1" width="0" style="border:none"></td></tr></tbody></table>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">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 ??<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">In this expression algs.sum(algs.volume(inputs[</span><b><i><span style="font-size:12.0pt">0</span></i></b><span style="font-size:12pt;font-family:Verdana,sans-serif">])), what
does the </span><b><i><span style="font-size:12.0pt">0 </span></i></b><span style="font-size:12pt;font-family:Verdana,sans-serif"> stands for ? <u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">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.<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">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.<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif"> </span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">Any helps concerning this matter will be very
much appreciated.<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">Regards,<u></u><u></u></span></div>
<div style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">Islem Megdiche<u></u><u></u></span></div>
<div dir="ltr" style="margin:1.2pt 0cm"><span style="font-size:12pt;font-family:Verdana,sans-serif">PhD student<u></u><u></u></span></div></div><div><br clear="none"><br clear="none"></div><div></div></div></div></div><div><div><div> <div style="font-family:verdana,helvetica,sans-serif;font-size:16px"> <div style="font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:16px"> <div dir="ltr"><font size="2" face="Arial"> Le Mardi 23 février 2016 14h21, Cory Quammen <<a rel="nofollow" shape="rect" href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> a écrit :<br clear="none"></font></div> <br clear="none"><br clear="none"> <div>Hi Islem,<br clear="none"><br clear="none">Please reply-all to keep the discussion on the list so that others may<br clear="none">benefit from the discussion.<br clear="none"><br clear="none">First, is there a data array that describes whether a volume element<br clear="none">in your mesh contains water or some other element? If so, you can use<br clear="none">the Threshold filter under the Filters -> Alphabetical -> Threshold<br clear="none">menu to select only the elements representing water. You will have to<br clear="none">set the minimum and maximum to the value that represents water, then<br clear="none">click Apply.<br clear="none"><br clear="none">HTH,<br clear="none">Cory<br clear="none"><br clear="none">On Mon, Feb 22, 2016 at 1:14 PM, Megdich Islem <<a rel="nofollow" shape="rect" href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>> wrote:<br clear="none">> Hi again,<br clear="none">><br clear="none">> Thank you for your suggestion, Could you please explain how to do the first<br clear="none">> step because I am not the one who created the picture I sent you before.<br clear="none">><br clear="none">> Regards,<br clear="none">> Islem<br clear="none">><br clear="none">><br clear="none">> Le Lundi 22 février 2016 16h45, Megdich Islem <<a rel="nofollow" shape="rect" href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>> a<br clear="none">> écrit :<br clear="none">><br clear="none">><br clear="none">> Thank you for your reply. I will try your suggestions.<br clear="none">><br clear="none">> Regards,<br clear="none">> Islem<br clear="none">><br clear="none">><br clear="none">> Le Lundi 22 février 2016 14h22, Cory Quammen <<a rel="nofollow" shape="rect" href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> a<br clear="none">> écrit :<br clear="none">><br clear="none">><br clear="none">> Islem,<br clear="none">><br clear="none">> There are likely two steps:<br clear="none">><br clear="none">> 1). Threshold your volume to identify only the water-containing cells.<br clear="none">> It looks like you have a way to do this already?<br clear="none">><br clear="none">> 2). Compute the volumes of the water-containing cells and summing them up.<br clear="none">><br clear="none">> You can use the Threshold filter to do number 1 if you have a material<br clear="none">> code in the cell data. To compute the volume of the cells, add a<br clear="none">> Python Annotation filter to the Threshold filter. Set the Expression<br clear="none">> to<br clear="none">><br clear="none">> algs.sum(algs.volume(inputs[0]))<br clear="none">><br clear="none">> This uses the numpy-like interface in the Python layer to compute the<br clear="none">> volumes of the cells and sum them all up. The Python Annotation filter<br clear="none">> should display the volume with a text label in your renderer.<br clear="none">><br clear="none">> Hope this helps,<br clear="none">> Cory<br clear="none">><br clear="none">> On Mon, Feb 22, 2016 at 9:09 AM, Megdich Islem <<a rel="nofollow" shape="rect" href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>><br clear="none">> wrote:<br clear="none">>> Hi Cory,<br clear="none">>><br clear="none">>> Thank you very much for your prompt reply. I've attached here a picture<br clear="none">>> that<br clear="none">>> illustrates my problem. I am working on the break of bund walls and I want<br clear="none">>> to compute the volume of water that overtops the bund wall (walls<br clear="none">>> surrounding storage tank), after the solution reaches the steady state.<br clear="none">>><br clear="none">>> Regards,<br clear="none">>> Islem<br clear="none">>><br clear="none">>><br clear="none">>> Le Lundi 22 février 2016 13h53, Cory Quammen <<a rel="nofollow" shape="rect" href="mailto:cory.quammen@kitware.com" target="_blank">cory.quammen@kitware.com</a>> a<br clear="none">>> écrit :<br clear="none">>><br clear="none">>><br clear="none">>> Hi Islem,<br clear="none">>><br clear="none">>> This is the place to ask ParaView questions! There is some activity on<br clear="none">>> StackOverflow, but most people ask questions on this mailing list.<br clear="none">>><br clear="none">>> Could you clarify what you want to compute? Do you just want to subset<br clear="none">>> a volume mesh and display the results over time? Do you want to<br clear="none">>> compute one quantity and display it as a graph over time? Do you want<br clear="none">>> to compute a single number from a time series data set?<br clear="none">>><br clear="none">>> Thanks,<br clear="none">>> Cory<br clear="none">>><br clear="none">>> On Mon, Feb 22, 2016 at 8:48 AM, Megdich Islem <<a rel="nofollow" shape="rect" href="mailto:megdich_islem@yahoo.fr" target="_blank">megdich_islem@yahoo.fr</a>><br clear="none">>> wrote:<br clear="none">>>> Hello,<br clear="none">>>><br clear="none">>>> I am new to paraview, and I didn't find a forum under paraview website to<br clear="none">>>> ask my question.<br clear="none">>>> My question is is there any filter in paraview that lets to compute the<br clear="none">>>> evolution of a quantity within a specific volume of the mesh.<br clear="none">>>><br clear="none">>>> Regards,<br clear="none">>>> Islem<br clear="none">>>><br clear="none">>>> _______________________________________________<br clear="none">>>> Powered by <a rel="nofollow" shape="rect" href="http://www.kitware.com/" target="_blank">www.kitware.com</a><br clear="none">>>><br clear="none">>>> Visit other Kitware open-source projects at<br clear="none">>>> <a rel="nofollow" shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">>>><br clear="none">>>> Please keep messages on-topic and check the ParaView Wiki at:<br clear="none">>>> <a rel="nofollow" shape="rect" href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br clear="none">>>><br clear="none">>>> Search the list archives at: <a rel="nofollow" shape="rect" href="http://markmail.org/search/?q=ParaView" target="_blank">http://markmail.org/search/?q=ParaView</a><br clear="none">>>><br clear="none">>>> Follow this link to subscribe/unsubscribe:<br clear="none">>>> <a rel="nofollow" shape="rect" href="http://public.kitware.com/mailman/listinfo/paraview" target="_blank">http://public.kitware.com/mailman/listinfo/paraview</a><br clear="none">>><br clear="none">>>><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">>> --<br clear="none">>> Cory Quammen<br clear="none">>> R&D Engineer<br clear="none">>> Kitware, Inc.<div><br clear="none">><br clear="none">>><br clear="none">>><br clear="none">>><br clear="none">><br clear="none">><br clear="none">><br clear="none">> --<br clear="none">> Cory Quammen<br clear="none">> R&D Engineer<br clear="none">> Kitware, Inc.<br clear="none">><br clear="none">><br clear="none">><br clear="none">><br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Cory Quammen<br clear="none">R&D Engineer<br clear="none">Kitware, Inc.</div><br clear="none"><br clear="none"></div> </div> </div> </div></div></div></div></div></blockquote></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div>Cory Quammen<br clear="none">R&D Engineer<br clear="none">Kitware, Inc.</div>
</div>
</div></div></blockquote></div></div><br clear="none"><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div>Cory Quammen<br clear="none">R&D Engineer<br clear="none">Kitware, Inc.</div>
</div></div></div><br><br></div> </div> </div> </div></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Cory Quammen<br>R&D Engineer<br>Kitware, Inc.</div>
</div>