Welcome, Guest
Username: Password: Remember me

TOPIC: Extract interpolated value or node values from many simulation results

Extract interpolated value or node values from many simulation results 6 years 2 months ago #29207

  • pyodimille
  • pyodimille's Avatar
I made some wave refraction simulations with TOMAWAC of the same sea area with different wave directions and heights, so I have 56 simulation results. For any simulation I need the wave height and mean direction in a particular point (near the entrance of a harbour), at the last timestep. Is there a quick way for getting these values for every simulation or do I need to do it manually?
And for exporting graphically the results with the vector field of wave direction versors? (I did it for a single simulation in PrePro, but doing it manually for every simulation would be quite time-consuming)

Thanks!
The administrator has disabled public write access.

Extract interpolated value or node values from many simulation results 6 years 2 months ago #29218

  • pprodano
  • pprodano's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 95
  • Thank you received: 54
Hello,

I don't know how this could be done in Fudaa, but you can do it with Python using my pputils project.

There is a script that extract the last time step of each *.slf file, and places is in one file. I did this for my wave library scripting. Assume you have 56 result files in one directory, the script mkwavelibfile.py (bad name I know) will read each *.slf file, extract the last time step, and store it in a new *.slf file. The result file will have 56 time steps (the last time step from each of your 56 runs).

Then to extract the results from a TELEMAC result file at a given node, you would execute this:

python3 extract_pt.py -i result.slf -x 100 -y 100 -o result_100.csv

where -i is your input file, and -x and -y are the coordinates of your point of interest. You will have 56 values of wave height and wave direction in the *.csv file.

I also have a sel2png.py script, that will take a TELEMAC result file, will and automatically generate an image (with vectors if you wish). You would have do this:

python sel2png.py -i input.slf -c sel2png.cfg -v 4 -o output.png -s 0 -e 10

where -i is your input file, -c is the configuration file (where you specify things like colour codes, zoom level, vectors, etc), -v is the index of the variable you want, -o is the name of the output file, and -s and -e are the starting and ending time step for which you want a plot.

Let me know if it works for you,

Pat
The administrator has disabled public write access.
The following user(s) said Thank You: pyodimille

Extract interpolated value or node values from many simulation results 6 years 2 months ago #29229

  • pyodimille
  • pyodimille's Avatar
I'm having some trouble with extract_pt.py. It doesn't work on my computer giving me the following error:

C:\Users\MASTER\Desktop\pputils-master>python extract_pt.py -i master_wave_lib.s
lf -x 354340.0 -y 4571620.0 -o out.txt
Traceback (most recent call last):
File "extract_pt.py", line 49, in <module>
from scipy import spatial
File "C:\opentelemac-mascaret\python27\lib\site-packages\scipy\spatial\__init_
_.py", line 89, in <module>
from .qhull import *
ImportError: DLL load failed: Impossibile trovare il modulo specificato.

The exception error is in Italian, it means "Impossible to find specified module"

Other scripts, instead, worked well, and made me save many hours of work!
The administrator has disabled public write access.

Extract interpolated value or node values from many simulation results 6 years 2 months ago #29243

  • pprodano
  • pprodano's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 95
  • Thank you received: 54
Hi,

It looks like that scipy is not installed with you python installation. To check if this is the case, type the following at the python terminal:

import scipy as sp

If you get the same error, it means you don't have scipy installed.

Note that to fully use pputils you will need numpy, scipy and matplotlib libraries. There are many ways to install them.

I hope it helps,

Pat
The administrator has disabled public write access.
The following user(s) said Thank You: pyodimille

Extract interpolated value or node values from many simulation results 6 years 2 months ago #29244

  • pyodimille
  • pyodimille's Avatar
I tried
import scipy as sp
but no, it doesn't give me any error and seems that scipy is installed. However, I will try with another python installation on another computer.
The administrator has disabled public write access.

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