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

TOPIC: Selafin File

Re:Selafin File 13 years 7 months ago #1314

  • jmhervouet
  • jmhervouet's Avatar
Hi,

Well I see no obvious error. Try the following program, I hope it helps.

PROGRAM ReadSelaphin

INTEGER IERR
CHARACTER(LEN=80) :: strTitle

OPEN(1, FILE="C:\TELEMAC\Sta2.ref", FORM="UNFORMATTED",STATUS='OLD',IOSTAT=IERR)
IF(IERR.NE.0) PRINT*,'ERROR ',IERR

OPEN(2, FILE="C:\TELEMAC\Sta2.txt", FORM="FORMATTED")

READ(1, END=5, ERR=7) strTitle(1:80)
GO TO 999
5 PRINT*,'END OF fILE 1'
GO TO 1000
7 PRINT*,'ERROR IN FILE 1'
GO TO 1000
999 WRITE(2,*) strTitle(1:80)
1000 CONTINUE
CLOSE(1)
CLOSE(2)
STOP
END
The administrator has disabled public write access.

Re:Selafin File 13 years 7 months ago #1315

  • Chris Cawthorn
  • Chris Cawthorn's Avatar
Could it perhaps be a problem with the binary encoding?

Remember that Selafin files use 'big-endian' encoding, and this might not be the default assumed by your compiler. Your test binary file could have a different encoding, which would explain why it works when the Selafin file doesn't.

What command are you using to compile your Fortran, Fezai? If you're using ifort, it might help to add
/convert:big_endian
to your compile line.

Good luck!
The administrator has disabled public write access.

Re:Selafin File 13 years 7 months ago #1317

  • fezai
  • fezai's Avatar
Hi,

Thank you so much for your time Jean-Michel and Chris. Now it works, the problem is, in fact, the encoding.

- it works by adding /convert:big_endian in the command line with ifort ;

- it also works by adding CONVERT="BIG_ENDIAN" in the OPEN options :
OPEN(1, FILE="C:\TELEMAC\Sta2.ref", FORM="UNFORMATTED", CONVERT="BIG_ENDIAN")

Kind Regards

Fezai
The administrator has disabled public write access.

Re:Selafin File 13 years 7 months ago #1321

  • jmhervouet
  • jmhervouet's Avatar
Hi,

Oh, I understand, the binary produced by Telemac is always BIG_ENDIAN, it ensures portability of files between platforms, so we use compiler directives to do this when necessary.

It is better tu use compiler options to automatically convert files, without changing Fortran sources, so your first solution is the best. This gives portable code.

With best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.

Re:Selafin File 12 years 7 months ago #4384

  • fay
  • fay's Avatar
'Alternatively...
1. File->Open the SELAFIN file with Blue Kenue.
2. Select the variable you wish to export in the WorkSpace.
3. File->Save Copy As... (changing the "Save as type" to XYZ) creates an ASCII XYZ file.'


Thanks for the response above. I am trying to create a table of my node numbers and their positions, if I save a selafin file as an xyz for example my bottom mesh file it only saves the position and bottom depth in the file even though in Blue Kenue it knows the numbers of the nodes. Can anyone tell me how I get Blue Kenue to also save the node number next to the co-ordinates of the node?

Cheers

Fay
The administrator has disabled public write access.

Re:Selafin File 12 years 7 months ago #4386

  • fay
  • fay's Avatar
Is the list in node number order?
The administrator has disabled public write access.

Re:Selafin File 12 years 6 months ago #4397

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

If you create a XYZ file with Blue Kenue, the coordinates are in fact in "node number order".

Hope this helps... Martin
The administrator has disabled public write access.
The following user(s) said Thank You: fay
  • Page:
  • 1
  • 2
Moderators: Serrer, a.barton

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