Welcome, Guest
Username: Password: Remember me

TOPIC: Problem opening slf file in fortran subroutine

Problem opening slf file in fortran subroutine 6 years 10 months ago #28465

  • jescobar
  • jescobar's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 22
  • Thank you received: 2
Hello,

I am trying to open a slf file using a modified version of bord.f subroutine. Along subroutine bord.f, the file is supposed to be read several times by calling subroutine lit.f. However, every attempt to call lit.f causes the run to crash. Here are the console output, and the subroutine I use for my case:

File Attachment:

File Name: Console.txt
File Size: 44 KB

File Attachment:

File Name: bord.f
File Size: 29 KB


I first thought the file was corrupted, but it can be opened and its variables seen with Blue Kenue. Moreover, it is correctly copied into the run temporary folder, and can also be queried within the run. Here it is before and after getting copied into the temporary folder.

drive.google.com/open?id=1SkGbq41ssK9L3byqBjFLqfGjCqtoohRC

Any idea of what might cause of this problem?


Regards,

Sebastian
The administrator has disabled public write access.

Problem opening slf file in fortran subroutine 6 years 10 months ago #28468

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
Hi Sebastian,

If I well understand your problem, you're trying to read a serafin file, on a different grid, thanks to the "BINARY DATA FILE 2" (channel T2DBI2) in the bord.f subroutine, and you have set "BINARY DATA FILE 2 FORMAT = 'SERAFIN '" (with a space at the end), I'm suspicious about fidc='STD' in your bord.f subroutine, and bout the channel 2 you have in the printouts, normally it's the channel 25 for this file... If it's well the case, this file is already open previously by the code.

I think your error message comes from this line:
CALL LIT(FRES,WRES,NBVAR,TITRES,2,'I',fidi,fidc,ISTAT)
You should add a space character after 'I' and so replace the previous line by:
CALL LIT(FRES,WRES,NBVAR,TITRES,2,'I ',fidi,fidc,ISTAT)

Another (simpler) way to read a serafin file is to use the subroutines of the hermes module (get_bnd*, get_mesh*, get_data*)
You can define a bief mesh object dedicated to your mother grid, and store the read data on bief objects (also related to your mother grid).

Hope this helps.

Regards,
Laurent
The administrator has disabled public write access.

Problem opening slf file in fortran subroutine 6 years 10 months ago #28476

  • jescobar
  • jescobar's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 22
  • Thank you received: 2
Thanks for your answer Laurent,

It is indeed weird that the file channel be 2, when the regular channel for the binary data file 2 should be 25 (as stated here).

I did try as you suggested to add a space after "I" when calling LIT subroutine but it did not work. What actually worked was adding the command -fconvert=big-endian in my cfg file. Apparently, what caused the model to crash was that it could not open big endian type files. I attach the file in case somebody has a similar problem.

File Attachment:

File Name: systel.ubuntu_2017-12-29.cfg
File Size: 3 KB


However, now that the model is running I have another issue, it is very cpu demanding. Do you think using get_bnd, get_mesh or get_data, instead of lit would make it simpler and less demanding?

Regards,

Sebastian
The administrator has disabled public write access.

Problem opening slf file in fortran subroutine 6 years 10 months ago #28477

  • Leballeur
  • Leballeur's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 434
  • Thank you received: 163
Hi Sebastian,

Really strange that you don't have T2DBI2=25. It seems there is something wrong somewhere... Are you in coupling mode ? I also saw you're using the trunk (no-tagged) version of the code, be careful.
The "BINARY DATA FILE 2 FORMAT" should also be "SERAFIN".

It's also strange that without the "big-endian" compilation flag, you didn't have any problem to read other serafin files (like geometry file for instance) or to write results.

The error message was clear though:
At line 70 of file /home/sebastian/telemac/trunk/sources/utils/hermes/lit.F
Fortran runtime error: Substring out of bounds: upper bound (2) of 'type' exceeds string length (1)

At line 70 of lit.F, type(1:2) is compared to 'R4', that causes an exceed in the size of your string argument provided to lit.F which is of length 1. Other call to lit.F in the telemac system are done with an additional space: 'I '.

What do you mean by "very cpu demanding" ?
It's difficult to say if it will improve cpu performances. Can you give an order of computational times and memory resources with and without your modified subroutine bord.f please ?

Regards,
Laurent
The administrator has disabled public write access.

Problem opening slf file in fortran subroutine 6 years 10 months ago #28485

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

It is normal that T2DI2 is not equal to 25.
You should use
fidi = T2D_FILES(T2DBI2)%LU
instead of
fidi= T2DBI2

This was changed in the latest version of Telemac-Mascaret.

Hermes might indeed be more efficient as it is using stream access to read the file instead of how it is read using lit.

Hope it helps
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.