Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: how to extract data from slf file?

how to extract data from slf file? 9 years 8 months ago #16259

  • zqzuoan
  • zqzuoan's Avatar
hi, everyone,
I want to extract the results of all the time from the result file(.slf). Can anybody tell me how to do it?
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16262

  • konsonaut
  • konsonaut's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 413
  • Thank you received: 144
Hi,

probably the most easiest way is using BlueKenue. Saving all the time steps you just can save the variable as binary t3s or t3v file.
Under Tools -> Extract Surface -> Temporal Ranges you can save a variable specifying the temporal range.
Other common options are Tecplot, Paraview or the (existing) Python scripts.

Hope this helps,
Clemens
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16287

  • zqzuoan
  • zqzuoan's Avatar
hi, I have done as you said. But it seems that there is only data at a time.
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16289

  • konsonaut
  • konsonaut's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 413
  • Thank you received: 144
Yes, you are right. Sorry. Actually the button -> Temporal Ranges has another meaning, see page 90, Reference Manual of BlueKenue.
Ok, another try B) which hopefully works but seems to be a little bit complicated
Use the calculator:
for scalar values: select the variable, specify the start and end frames, the expression is simply A, calculate and save.
for vectors: extract separately both the U and V components in the desired range, and then under Tools -> Create Vector Field you can create from the scalars again a vector mesh.

Hope this helps.
Clemens
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16297

  • Serrer
  • Serrer's Avatar
  • OFFLINE
  • Moderator
  • Posts: 720
  • Thank you received: 304
Hi zqzuoan,

Can you explain a bit more what you are trying to do?

Is it a time-series at a point or multiple points you are trying to extract?

Or are you trying to extract a single variable over the whole simulation?

There are numerous ways to extract information from a slf file.

Cheers... Martin
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16300

  • zqzuoan
  • zqzuoan's Avatar
I want to export some variables over the whole simulation in a non binary form. I know fudda can export, but it's too slow because my simulation'time is very long.
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16303

  • konsonaut
  • konsonaut's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 413
  • Thank you received: 144
Hello,
if I understand you correctly you want an ASCII file with e.g. the water depths at all nodes and all time steps (frames).

If you are a little bit familiar with Python you can use the script enclosed.
You need Python 2.7.xx and Numpy.
Basically it writes out the water depths columnwise beginning from frame 1 and so on. The first two columns are x and y coordinates, respectively. So this is a common format for scatter data in Tecplot, Paraview, ...

Lines to configure:
line 4 : Path to the Telemac Python scripts (for parsing the slf file)
line 13, 14, 16, 17: Input / Output folder and files
line 35 and 37: which frames and which variable

But be aware that this script can also be very slow since the biggest bottleneck is the writing of the results to an ASCII file. So Fudaa may be actually faster.
So for example reading and the creation of the numpy array with 120000 nodes and 190 frames costs around 1 second. Writing the ASCII file with 120000 lines and 190 columns costs 15 seconds.

So this could be also a good starting script if you want another format in the ASCII file etc.

Hope this helps,
Clemens
Attachments:
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16355

  • anasrahman
  • anasrahman's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Thank you received: 1
Hello Konsonaut

Regarding your python script,

1. It is used to extract a variable at all nodes. However, if I want to extract 2 or more variables at a specific node, how can I do that?

2. And can this script be used for 3D model as well?

Best regards
Anas
The administrator has disabled public write access.

how to extract data from slf file? 9 years 8 months ago #16358

  • konsonaut
  • konsonaut's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 413
  • Thank you received: 144
Hello,

there are more possibilities:
you can add a second line in the For loop to extract a second variable.

Accessing the variable at a specific node over all time steps:
nodenumber = 4350
print z_var[:,nodenumber-1] # -1 because numbering begins with 0.

at a specific frame, for example frame 6: (again, numbering begins with 0)
print z_var[5,nodenumber-1]

Basically you have all the things there to proceed but specifically for your needs, "extract 2 or more variables at a specific node", see
www.openmascaret.org/index.php/kunena/sc...at-points-with-pytel

Yes, you can use this script also for 3D models but there exist better scripts, see_:
www.openmascaret.org/index.php/kunena/sc...-getvaluepolyplanslf

Hopte this helps,
Clemens
The administrator has disabled public write access.

how to extract data from slf file? 9 years 7 months ago #16442

  • anasrahman
  • anasrahman's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 33
  • Thank you received: 1
Dear Clemens,

Thank you for your guide.

I have added the lines as you suggested in the script for extracting 2 variables at specific point. Could you be kind to have a look at the attached script?

The frames that you mentioned in the script, does it refer to the time step, or the layers?
frames = range(0,len(times),1) > does it refer to the Time step of 1 till 2 or the whole simulation time step?

Then, I am also curious as to where do I need to specify the specific layer that I would like to extract my data from, for example, for layer 2, 6 and 10?

And for example if I need to extract data from 3 nodes, would adding these lines be correct / sufficient?

nodenumber1 = 8741 # for specific node
print z_var[:,nodenumber1-1]

nodenumber2 = 8741 # for specific node
print z_var[:,nodenumber2-1]

nodenumber3 = 8741 # for specific node
print z_var[:,nodenumber3-1]


Again, thank you for your insight and advice.

Regards
Anas
Attachments:
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: pham

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.