Welcome, Guest
Username: Password: Remember me

TOPIC: Modifying bord.f to read binary file

Modifying bord.f to read binary file 11 years 4 months ago #9522

  • f.luxford
  • f.luxford's Avatar
Hi

I wish to modify the bord.f subroutine to read a binary file. I have included the binary file via the steering file as BINARY DATA FILE 1, then within bord.f I try and read from it as follows:

USE DECLARATIONS_TELEMAC2D, ONLY: T2D_FILES,T2DBI1
INTEGER NBI1
DOUBLE PRECISION TEMP

NBI1 = T2D_FILES(T2DBI1)%LU

REWIND(NBI1)
READ(NBI1)TEMP

I can read the binary file in a standalone FORTRAN program but when I try and read it in bord.f as detailed above I get the following error from the READ statement:

forrtl: severe(39): error during read, unit 24

The code runs with READ(NBI1) i.e. not storing the value. Does anyone know why this doesn't work please? In the stand alone program I open the binary file as follows:

OPEN(NBI1,FILE='data.dat',status='old',form='unformatted')

Thanks

Fay
The administrator has disabled public write access.

Modifying bord.f to read binary file 11 years 4 months ago #9530

  • riadh
  • riadh's Avatar
Hello

The problem could be your read(nb1) which can not be able to distinguish between formatted and unformatted data.

Kind regards
Riadh
The administrator has disabled public write access.

Modifying bord.f to read binary file 11 years 4 months ago #9590

  • jmhervouet
  • jmhervouet's Avatar
Hello Faye,

I see no real problem in what you do, except if you are in parallel mode. In this case you could have to change the telemac-2d dictionary at the line :

SUBMIT = 'T2DBI1-READ-24;T2DBI1;FACUL;BIN;LIT;SELAFIN'

that states that this file must be partitioned in parallel. Maybe putting SCAL instead of SELAFIN would then solve the problem (if not because several processors try to read the same file, then PARAL instead of SCAL is my last ammunition).

Beware also that bord.f is called at every time step, so in your example you would rewind every time and get the same TEMP ? (in that case a SAVE command and a logical in DATA would allow you to read the file only at the first call).

With best regards,

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

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