Personal tools
You are here: Home Forum How to use Salome? Animation of post-processing fields with mesh transformation

Animation of post-processing fields with mesh transformation

Up to How to use Salome?

Animation of post-processing fields with mesh transformation

Posted by Loïc Chevallier at October 11. 2011

Hello,

I use SALOME for post-processing of electromagnetic dynamic problems solved by an external program, e.g. evolution along time of fields in an electric motor. I would like to see the animation of the fields along time, but the mesh changes, e.g. one part rotates, during time. I am able to create such meshes in MED format, and my fields are also stored in MED format.

I know that MED format permits such features of fields attached to various meshes. My program stores everything in the same MED file, but SALOME (last version) separates the fields according to each mesh (with different names), and animation is not possible. Besides

Could you please confirm to me that SALOME is able to animate such fields, and teach me how to properly create the appropriate MED file ?

Thank you,

Loïc Chevallier.

Re: Animation of post-processing fields with mesh transformation

Posted by SMESH expert at October 12. 2011

Hello Loïc

So far SALOME is unable to animate meshes changing with time in VISU module for sure. As about PARAVIS module, please refer to its documentation to be sure, but most probably neither.

Best regards

Re: Animation of post-processing fields with mesh transformation

Posted by Loïc Chevallier at October 12. 2011

Hello,

Thank you for such a quick answer. Some colleagues said to me that successive animation was able to be applied on fields in several already loaded MED files, e.g. the same field but each time step corresponds to one MED file. Of course the timestamp for each field is correct.

I was able to make such an animation and also to select all fields loaded with the same name (see script below). When right-clicking on the selection in order to create the successive animation, my file names are not sorted along time, despite their name is correct, the time stamp for each field is correct, and my MED files are loaded in SALOME according to the the time, i.e. time=2s after time=1s. Also Entry values of fields are sorted according to time, i.e. Entry='0:1:1:3:1' for time=1s, Entry='0:1:2:3:1' for time=2s.

Could you please teach me how to order the list of Fields in animation ?

Best regards,

Loïc chevallier.

P.S. Script to select all fields with the same name (BFIELD, Tesla) in Post-processing mode :

salome.sg.ClearIObjects() # clear all selected objects
all = salome.myStudy.FindObjectByName("BFIELD, Tesla","VISU") # list of all objects, sorted according to their Entry value
for a in all:
  id = a.GetID() # get Entry value for each object
  salome.sg.AddIObject(id) # Make this object selected

print "Number of 'BFIELD, Tesla' selected: ",salome.sg.SelectedCount() # message

Re: Animation of post-processing fields with mesh transformation

Posted by SMESH expert at October 12. 2011

I think you can have a full control of animation by using its Python API (see VISU/bin/salome/visu_succcessive_animation.py).

It seems that order of fields depends on order of anAnim.addField(aSObj) calls.

Best Regards

Re: Animation of post-processing fields with mesh transformation

Posted by Loïc Chevallier at December 05. 2011

Previously SMESH/MED expert wrote:

I think you can have a full control of animation by using its Python API (see VISU/bin/salome/visu_succcessive_animation.py).

It seems that order of fields depends on order of anAnim.addField(aSObj) calls.

Best Regards

You were write: using successive calls to the addField method does the job of ordering fields as I entered them.

Now the hard part is to get a properly ordered list of fields objects, i.e. by ascending Entry i.e ID.

I made several tests, where I import my MED files in the right order, i.e. first time step, second time step, etc. ID's values are properly ordered, i.e. I get something like:

first field ID:        0:1:1:1:1:3:1
second field ID: 0:1:1:2:1:3:1
third field ID:      0:1:1:3:1:3:1
...
tenth field ID:     0:1:1:10:1:3:1

The first method, based on selecting all these fields -- either manually or automatically based on the field name -- does not work properly. I may get this list of IDs, but it is not sorted, i.e. the order may be: 2, 1, 3... I think this is the way used by the animation feature using GUI.

Using Python, I have tried to sort this array of ID strings, and it works for the numbers from 1 to 9 or 10 to 19, etc. but not for number from 1 to 13, as the order is 10, 11, 12, 13, 1, 2, 3... 9.

Finally I found a way, i.e. getting a list of IDs by a search on field names. Surprisingly, the list of IDs is properly sorted. The relevant part of the attached full script is, for the field named 'BFIELD, Tesla':

import salome
fields = salome.myStudy.FindObjectByName('BFIELD, Tesla',"VISU")
for field in fields:
  myAnimation.addField(field)

Best regards.

Attachments
Powered by Ploneboard
Document Actions