[Paraview] question-filter

Cory Quammen cory.quammen at kitware.com
Mon Mar 28 21:54:14 EDT 2016


On Sun, Mar 27, 2016 at 7:30 AM, Megdich Islem <megdich_islem at yahoo.fr> wrote:
> Hey Cory,
>
> Thank you for your email. I tried using the python calculator with the
> expression you gave me but I got error saying that name ''volumes''  doesn't
> exist

Oops. Try 'volume' instead. Sorry about that.

 I also used the python annotation filter to calculate the volume of
> oil in a region that I can estimate the real volume but  instead of getting
> a scalar, I got a VTK array. I attached pictures that illustrate every
> thing, I also attached a picture of the mesh that I created with salome
> platform.

Looks like you forgot to sum() the results of alphaoil*volume(input).

>
> Regards,
> Islem
>
>
> Le Jeudi 24 mars 2016 15h48, Cory Quammen <cory.quammen at kitware.com> a écrit
> :
>
>
> Islem,
>
> One possibility is that the order of vertices in your grid is somehow
> different than what VTK expects and gives you inverted cells that have
> negative volume. I don't know if this is the case because your
> negative volume is much different from the expected positive volume.
>
> Could you try using the Python Calculator to compute the volumes of
> each cell and see if they are all negative? The expression should be
> something like
>
> volumes(input)
>
> (haven't tested this). This would at least be a first step in
> debugging the problem.
>
> HTH,
> Cory
>
>
> On Mon, Mar 21, 2016 at 8:21 AM, Megdich Islem <megdich_islem at yahoo.fr>
> wrote:
>> Hi,
>>
>> Thank you for your email, I tried this expression
>> sum(alphawater*volume(input)) and it worked fine and gave me some logical
>> results for some shapes that I know their volumes, but for the problem
>> that
>> I am working on, it gave me negative value for the volume. I am supposed
>> to
>> calculate the volume of a quarter of a cylinder with height 0.6 m and
>> radius
>> 0.3 m, so the volume should be V=(0.3*0.3*3.14*0.6)/4=0.04239 cubic meter,
>> but  the annotation filter gave me this value -2639.95829243. I attached
>> here two pictures that illustrate the dimensions of the cylinder and the
>> value I got, I couldn't what is wrong.
>>
>> Regards,
>> Islem Megdiche
>>
>>
>> Le Dimanche 20 mars 2016 10h57, Cory Quammen <cory.quammen at kitware.com> a
>> écrit :
>>
>>
>> Thanks, Utkarsh.
>>
>> Indeed, replacing "alpha.water" with "alphawater" appears to work just
>> fine.
>>
>> - Cory
>>
>> On Sat, Mar 19, 2016 at 7:23 PM, Utkarsh Ayachit
>> <utkarsh.ayachit at kitware.com> wrote:
>>>> 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.
>>>
>>> FYI, ParaView uses paraview.make_name_valid()[1] function to sanitize
>>> array names in Python. Any character not a "_" or ASCII letter or
>>> number is simply dropped and if the name beings with a number, then a
>>> 'a' is prefixed.
>>>
>>> [1]
>>>
>>> http://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/_modules/paraview/__init__.html#make_name_valid
>>
>>
>>
>>
>> --
>> Cory Quammen
>> R&D Engineer
>> Kitware, Inc.
>
>>
>>
>>
>
>
>
> --
> Cory Quammen
> R&D Engineer
> Kitware, Inc.
>
>



-- 
Cory Quammen
R&D Engineer
Kitware, Inc.


More information about the ParaView mailing list