Welcome, Guest
Username: Password: Remember me

TOPIC: HERMES library - modify data

HERMES library - modify data 5 years 9 months ago #32738

  • Fabien33
  • Fabien33's Avatar
Hi Telemac users et developers,

I’m currently learning how to use Hermes Library.

I have tried tried all “reading” subroutines and I have no problem to make them work with my “slf” files.

As for “writing” subroutines, I’ve tried to use the subroutine “ADD_DATA_SRF”, so far, in vain.

What I want to do is to modify “BOTTOM FRICTION” data of an SLF file and so far, it doesn’t work.

I have two questions :

- Do I first have to open “slf” file with the option “openwrite” (subroutine "open_mesh").

- I just want to update bottom friction data after creating the variable “bottom friction” in an “slf” geometry file. So it’s a kind of untemporally file without notion of “time”. What do I put as TIME, RECORD AND FIRST_VAR subroutine arguments ?

- Another subsidiary question. When “bottom friction” is stationary, does Telemac make a copy at each time step or is there a pointer towards the first timestep ?

NB : I know it’s possible to easily modify ”bottom friction” data with subroutine like strche. But, I know in the end, the modification is done with the help of Hermes library and this is what I want to understand.

Best regards,

Fabien
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32741

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Hi,

- For the openmode you need write or readwrite (if you give write it will use readwrite anyway)

- I'll answer your last point first as it will help for the the second point.
Indeed stationary variable are written at each time step.

- FIRST_VAR should be .true. if bottom is the is the first variable in your file (same order as the one given by get_data_var_list).
For RECORD and TIME you need to give the time and record for which you want to replace bottom.
TIME is overwritten in the file if FIRST_VAR is true.
RECORD is used to determine where to write.

Hope it helps,
yugi
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32762

  • Fabien33
  • Fabien33's Avatar
Hi Yugi,

Thanks for your response.
I spend all this morning trying what you said.

1- I tried to open my mesh with "openwrite". It doesn't work. Apparently, when the mesh is opened with "openwrite" option, all parameters (in particular NPOIN and NVAR) are initialized null (line 565 of utils_serafin.f). So I continued opening my mesh with "read" option

2- I initialized TIME at 0 (in reality the value is not null but very small) RECORD at 1, and FIRST_VAR at true. It still does not work. So I put some markers in the add_data_srf.f subroutine to see where the error happened. It happed at line 2376 ( WRITE(FILE_ID,IOSTAT=IERR) TAG,REAL(TIME),TAG ).

I join my documented fortran main code, the modified subroutine utils_serafin.f with markers and a capture of my cygwin console.

Maybe you'll have some suggestion ?!

Best regards,

Fabien
Attachments:
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32763

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
Hi,

By the way did you know that the hermes library is also available in Python (If telemac is installed with the proper options).

1. Indeed i forgot about that fact. In python I create a function to load a mesh information from another one to solve that issue.

2. RECORD starts from 0

You'll find attached a work around to make it work.
Tell me if it works for you as well.

I think in the future I will change how the readwrite behaves.
Now it is follow this rule:
READ - read only file already full
WRITE - file from scratch
READWRITE - same as WRITE
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32764

  • Fabien33
  • Fabien33's Avatar
Thank you very much.
I'm going to test your idea but I think you forgot to join the attached file.

Fabien
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32766

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
It seems it was blocked.
Here it is you'll have to change the extension to .f90
Attachments:
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32769

  • Fabien33
  • Fabien33's Avatar
Hi Yugi,

Thanks for your work.

I integrated your file without changing a line.

There is no error at compilation or linking.

There is an action too on the slf file. But, when I open the mesh with Bluekenue, there is an error (see joinded file).

Fabien
Attachments:
The administrator has disabled public write access.

HERMES library - modify data 5 years 9 months ago #32771

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
I forgot to check the file.
It is not working.
You'll need to read all the data from your file and rewrite everything in a new file.
That is the only solution until I code the proper readwrite.
There are 10 types of people in the world: those who understand binary, and those who don't.
The administrator has disabled public write access.
Moderators: pham

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