Welcome, Guest
Username: Password: Remember me

TOPIC: turning wind test

turning wind test 11 years 5 months ago #9221

  • Estanislao
  • Estanislao's Avatar
hello everyone,

I am trying to simulate the variation of the wind speed as well as its direction throughout a year with this test. However, it seems like i have an error in my syntaxis(I am quite clumsy with FORTRAN yet).Thanks in advanced

C.....VARIABLES TRANSMISES
C """"""""""""""""""""
INTEGER NPOIN2, VITES, DIR_1, v
DOUBLE PRECISION AT , DDC , VX_CTE, VY_CTE
DOUBLE PRECISION X (NPOIN2) , Y (NPOIN2)
DOUBLE PRECISION UV(NPOIN2) , VV(NPOIN2)
C
CMB
Modif debut
C
C.....VARIABLES LOCALES
C """""""""""""""""
INTEGER IP
DOUBLE PRECISION UCONST, VCONST, VITES, DIR_1, CNVR, v

C.....VITES : vitesse du vent en m/s (constante ici)
C.....DIRR_1 : direction initiale du vent (en degres, par rapport au Nord)
C.....DIRR_2 : direction finale du vent (en degres, par rapport au Nord)
C NB : il s'agit de directions vers ou souffle le vent.

OPEN(UNIT=112,FILE='/home/estanislao.gavilan/beach/turning_wind/winds2.dat',STATUS='OLD',ACTION='READ') VITES,DIR_1

v=VITES*0.514444444.D0

CNVR=3.141592654D0/180.D0

UCONST=v*SIN(DIR_1*CNVR)
VCONST=v*COS(DIR_1*CNVR)
CLOSE (112)

DO IP=1,NPOIN2
UV(IP)=UCONST
VV(IP)=VCONST
ENDDO
CMB
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9222

  • jmhervouet
  • jmhervouet's Avatar
Hello,

At least the line :

OPEN(UNIT=112,FILE='/home/estanislao.gavilan/beach/turning_wind/winds2.dat',STATUS='OLD',ACTION='READ') VITES,DIR_1

is not correct, it should be:

OPEN(UNIT=112,FILE='/home/estanislao.gavilan/beach/turning_wind/winds2.dat',STATUS='OLD',ACTION='READ')

READ(112,*) VITES,DIR_1

This is an example, it depends on how is written the file, it could be:

READ(112,*) VITES
READ(112,*) DIR_1

if there is one data per line

Maybe you also lack FORM='FORMATTED' in the open statement. Check also that your compiler allows units greater than 100 (this is not standard Fortran).

I hope this helps,

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

turning wind test 11 years 5 months ago #9225

  • Estanislao
  • Estanislao's Avatar
Jean,

thanks for you fast answer. I think my compiler (PLATO IDE) does not compile more than 71 data. Do you know how i can change this limitation?
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9229

  • jmhervouet
  • jmhervouet's Avatar
Hello,

There is perhaps a limitation to 72 columns, which is standard Fortran, but you may have up to 19 continuation lines, for example:

OPEN(UNIT=112,
&FILE='/home/estanislao.gavilan/beach/turning_wind/winds2.dat',
&STATUS='OLD',
&ACTION='READ')

where "&" must be in the sixth column.

JMH
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9233

  • Estanislao
  • Estanislao's Avatar
Jean,

I modified the code, and I could fix several error(with your suggestions).However, I stil have a problem to open my file. I do not think it is about the number of columns because there are only 2. This is the error that tomawac sends me when i try to run it. Thanks in advanced,I am sure it is a stupid mistake

error #5120: Unterminated character constant
OPEN(UNIT=112,FILE='/HOME/estanislao.gavilan/beach/turning_wind/wi
^
wacfort.f(71): error #5082: Syntax error, found END-OF-STATEMENT when expecting one of: ) ,
OPEN(UNIT=112,FILE='/HOME/estanislao.gavilan/beach/turning_wind/wi
^
compilation aborted for wacfort.f (code 1)
ERROR : COMPILATION

And this is the statement. I cannot see where i made the mistake

C.....VARIABLES LOCALES
C """""""""""""""""
INTEGER IP,I
DOUBLE PRECISION UCONST, VCONST, VITES, DIR_1, CNVR, P

C.....VITES : vitesse du vent en m/s (constante ici)
C.....DIRR_1 : direction initiale du vent (en degres, par rapport au Nord)
C.....DIRR_2 : direction finale du vent (en degres, par rapport au Nord)
C NB : il s'agit de directions vers ou souffle le vent.

OPEN(UNIT=112,&FILE='/HOME/estanislao.gavilan/beach/turning_wind/winds2.DAT',STATUS='OLD',ACTION='READ')
READ(112,*)

CNVR=3.141592654D0/180.D0

DO I=1,8760
P=VITES*0.514444444
UCONST=P*SIN(DIR_1*CNVR)
VCONST=P*COS(DIR_1*CNVR)
ENDDO
CLOSE(112)
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9235

  • jmhervouet
  • jmhervouet's Avatar
Hello,

Yes it is a problem of line length, when I say 72 columns it means 72 characters in a line. You should have a look at a basic course on Fortran, start the lines with 6 spaces and do not go beyond 72 characters in a line, so write like I suggested :

......OPEN(UNIT=112,
.....&FILE='/HOME/estanislao.gavilan/beach/turning_wind/winds2.DAT',
.....&STATUS='OLD',ACTION='READ')

where "." should be replaced by a space, I just put "." to show them.

then

READ(112,*)

is strange (and just skips a line), it was before :

READ(112,*) VITES,DIR_1

note that FILE='../winds2.DAT' will probably work as well, without the full path. I assume that you are on Linux, on Windows it should be '..\winds2.DAT'.

With best regards,

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

turning wind test 11 years 5 months ago #9237

  • Estanislao
  • Estanislao's Avatar
Jean,

As you thought, it is a problem with the characters. I could start the program, however, after appearing the word TOMAWAC. The program says that the file is not found. This file has been created in windows, although i am running TOMAWAC in UNIX. Should I convert the file to UNIX?Thanks for all, FROTRAN is completely new for me.

Estanislao
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9240

  • jmhervouet
  • jmhervouet's Avatar
Hello,

If it is an ASCII file it should work, however beware Windows carriage returns at the end of each line. So far the problem is that the file is not found. Check uppercase or lowercase characters (HOME sounds strange, isn't it home ? also is it really .DAT and not .dat ?). Then you can try a relative path FILE='../winds2.DAT'. Actually the program is executed in a temporary directory in directory turning_wind, so '../winds2.DAT' is the relative address of your file.

Regards,

JMH
The administrator has disabled public write access.

turning wind test 11 years 5 months ago #9247

  • Estanislao
  • Estanislao's Avatar
Thanks for you time. All your suggestions were
really helpful :cheer:
The administrator has disabled public write access.
Moderators: tfouquet

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