Common wind definition in Tomawac-Telemac2D coupling?

Hello,

I am setting up a Tomawac-Telemac2D coupled computation and I want to take a stationary wind into account. The wind XY constituents are defined in both the Tomawac and Telemac2D steering files. Do I need to enter both or one supersedes the other (like some other common variables)?

[name removed]

Hello,

No, you need to define the wind on both sides. Actually many things like this could be shared, like the geometry file and a number of keywords, but we did not venture into this game yet, except the number of processors, that is decided by the calling program.

[name removed]

Hello [name removed], thank you for your reply.

What I need to do in the end, is read wind timeseries from a formatted file. I have found that the sub-routine meteo in Telemac2D (my_option=2) does pretty much what I am looking for. Suppose I setup the subroutine meteo in the telemac2d fortran file to read from a specific file. Can I call meteo from subroutine [name removed]] to define wind for tomawac as well? Or should I repeat the, more or less, similar code in the venuti subroutine?

[name removed]

I did a bit more of reading and I found out that the sub-routine meteo is called once at the beginning of the calculation. If the wind is changing with time, then meteo is not applicable. I have found in this post (2806) an example of a subroutine (lecent) that interpolates the wind for every timestep. Is this subroutine included somewhere in the sources of v6p3?

[name removed]

Hello,

You may use the same subroutine meteo, but beware that the file containing wind will be duplicated under two different names, and that they will be opened with different logical units. You may have to use variable NAMECODE from declarations_telemac (24 characters) to know who has called meteo:

IF(NAMECODE(1:2).EQ.‘TE’) THEN

it is [name removed] unit is… T2DBI1

ELSEIF(NAMECODE(1:2).EQ.‘TO’) THEN

it is [name removed] unit is… WACVEB

ENDIF

I hope it does not become too tricky, otherwise you can work on a copy of meteo, e.g. meteo_tomawac, that avoids this (not very elegant but effective…)

With best regards,

[name removed]-Michel Hervouet

1 Like

Hello,

In Telemac-2D, meteo is read at every iteration, there are two calls in the subroutine telemac2d.f, so do you mean in Tomawac ?

[name removed]

Hello [name removed],

I admit, I am a bit confused :confused: . In meteo.f, line 109 it says:

! BEWARE, HERE ONLY ONE COMPUTATION AT FIRST TIMESTEP

So I assumed it does one interpolation at the beginning of the computation and it remains constant thereafter.

If meteo.f is called at every timestep, then it is OK regarding wind definition in telemac2d. In tomawac, as you said before, I will try using meteo.f ‘effectively’ to begin with. :beers:

Many thanks for your help.

[name removed]

Hello [name removed],

You are rignt, this message is confusing and obsolete, I’ll remove it in the next version.

[name removed]

Hi,

I am trying to adapt the example in meteo.f in venuti.f for tomawac, in order to read a timeseries in ASCII. Is there an example for venuti.f I can follow? What was the name of the subroutine that was employed to read the ‘VENTS-WAM-Cycle 4’ formatted file in the previous versions of tomawac?

[name removed]

Hello,

I have adapted parts of the meteo.f code for venuti.f. If I have understood correctly, venuti is just for reading the first 2 entries in the winds file, and the interpolation is carried out by other sub-routines. Please correct me if I am wrong.

The code looks like this:

!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

!

!     JUMPING TWO LINES OF COMMENTS

      READ(NVEN,*,ERR=100,END=200)

      READ(NVEN,*,ERR=100,END=200)

!     READING THE FIRST TWO LINES OF DATA

      READ(NVEN,*,ERR=100,END=200) TV1,U1(NPOIN),V1(NPOIN)

      READ(NVEN,*,ERR=100,END=200) TV2,U2(NPOIN),V2(NPOIN)

!

      RETURN

!-----------------------------------------------------------------------

! 

100   CONTINUE

      WRITE(LU,*) ' '

      WRITE(LU,*) 'VENUTI'

      IF(LNG.EQ.1) WRITE(LU,*) 'ERREUR DANS LE FICHIER DE VENT'

      IF(LNG.EQ.2) WRITE(LU,*) 'ERROR IN THE WIND FILE'

      CALL PLANTE(1)

      STOP  

200   CONTINUE

      WRITE(LU,*) ' '

      WRITE(LU,*) 'VENUTI'

      IF(LNG.EQ.1) WRITE(LU,*) 'FIN PREMATUREE DU FICHIER DE VENT'

      IF(LNG.EQ.2) WRITE(LU,*) 'WIND FILE TOO SHORT'

      CALL PLANTE(1)

      STOP           

!-----------------------------------------------------------------------

      RETURN

      END

The fortran file compiles OK, tomawac runs but the wind vectors in the results file present errors when I open in BlueKenue. Any hints on what I have done wrong?

[name removed]

Hello,

According to what I read, you just fill the values of U and V for point number NPOIN and leave the others unchanged, so probably what you want to do is:

INTEGER I

DOUBLE PRECISION WIND1X,WIND1Y,WIND2X,WIND2Y

READ(NVEN,*,ERR=100,END=200) TV1,WIND1X,WIND1Y

READ(NVEN,*,ERR=100,END=200) TV2,WIND2X,WIND2Y

DO I=1,NPOIN

U1(I)=WIND1X

V1(I)=WIND1Y

U2(I)=WIND2X

V2(I)=WIND2Y

ENDDO

[name removed]

1 Like

Hello [name removed],

Thank you very much for the help. I am starting to have a better understanding.

I have a new issue now. My winds file is something like that:

AT	WINDX	WINDY



0	0	0

250	-5	-10

500	-22.9	-16.1

1000	-22.9	-16.1

1500	-22.9	-16.1

2000	-22.9	-16.1

2500	-18.32	-12.88

3000	-12.824	-10.304

3500	-8.9768	-8.2432

4000	-6.28376	-6.59456

4500	-4.[phone removed]	-5.275648

5000	-3.[phone removed]	-4.2205184

meteof. subroutine in telemac2d interpolates at every telemac2d timestep, whereas tomawac takes the wind as constant between timesteps in the wind file, i.e. the wind changes abruptly at every timestep in the wind file.

Is this what it is supposed to do? Should I code the interpolation in time in venuti.f?

[name removed]

Hello,

Well, my understanding is that venuti returns two successive time steps of the file and the corresponding times, and then the subroutines calling venuti (see e.g. lecdoi) do the interpolation in time.

[name removed]

I have looked the relevant subroutines and it seems to me that [name removed] interpolates once at the beginning of the computation, LECDON does not interpolate and NOUDON interpolates once when it is called, i.e. when AT>TV2. In the computation timesteps between TV1 and TV2 in the winds file, the wind definition remains unchanged.

If this is correct there are two solutions:

1. I interpolate the winds file manually


1. I modify a tomawac subroutine to do it

In case of 2, what is the appropriate way? Increase the frequency NOUDON is called?

[name removed]

Hello,

Well it seems to me that in NOUDON the interpolation is outside the test AT>TV2, so the interpolation would be always done, am I wrong ?

I am not a specialist of Tomawac so I would have to look more closely, but my current understanding is that :

LECDOI is for initialising time varying values (so interpolation)

LECDON is for initialising constant in time values (so no interpolation)

NOUDON interpolates

so it would be OK ?

[name removed]

Having noticed an inconsistency in the wind output, I did a more refined research and I found that in subroutine VENUTI it clearly says:

!note DURING THE FIRST PASS THE USER MUST IDENTIFY THE TIMES TV1 AND TV2

!+ WHICH SURROUND THE FIRST TIME STEP. NEXT, USING THE ARRAYS

!+ XRELV,YRELV,UR,VR OR DIRECTLY FROM THE WIND FILE, THE USER

!+ MAY HAVE TO INTERPOLATE THE TIDES READ FROM THE FILE INTO THE

!+ ARRAYS U1,V1 U2,V2.

!+

…

!+

!+ THE CODE WILL INTERPOLATE THE WIND AUTOMATICALLY BETWEEN THESE

!+ 2 TIME STEPS.

!+

!+ THE OTHER PASSES OCCUR WHEN A NEW RECORD IS REQUIRED (AT>TV2).

!+ IN THIS CASE TV2,U2,V2 ONLY ARE TO BE COMPUTED.

I therefore modified my code accordingly (together with a modification to read Wind Direction & Speed instead of wind vectors):

!+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

!

      INTEGER I

      DOUBLE PRECISION DIR1,SPEED1,DIR2,SPEED2,CNVR

!

!-----------------------------------------------------------------------

!

      CNVR=3.141592654D0/180.D0

!

      IF (AT.EQ.0) THEN

! 

!     JUMPING TWO LINES OF COMMENTS

        READ(NVEN,*,ERR=100,END=200)

        READ(NVEN,*,ERR=100,END=200)

!     READING THE FIRST TWO LINES OF DATA

        READ(NVEN,*,ERR=100,END=200) TV1,DIR1,SPEED1

        READ(NVEN,*,ERR=100,END=200) TV2,DIR2,SPEED2

!

        DO I=1,NPOIN

          U1(I)=SPEED1*SIN(DIR1*CNVR)

          V1(I)=SPEED1*COS(DIR1*CNVR)

          U2(I)=SPEED2*SIN(DIR2*CNVR)

          V2(I)=SPEED2*COS(DIR2*CNVR)

        [name removed]

      ELSE

        READ(NVEN,*,ERR=100,END=200) TV2,DIR2,SPEED2

        DO I=1,NPOIN

         U2(I)=SPEED2*SIN(DIR2*CNVR)

         V2(I)=SPEED2*COS(DIR2*CNVR)

        ENDDO

      ENDIF

!

      RETURN

!-----------------------------------------------------------------------

! 

100   CONTINUE

      WRITE(LU,*) ' '

      WRITE(LU,*) 'VENUTI'

      IF(LNG.EQ.1) WRITE(LU,*) 'ERREUR DANS LE FICHIER DE VENT'

      IF(LNG.EQ.2) WRITE(LU,*) 'ERROR IN THE WIND FILE'

      CALL PLANTE(1)

      STOP  

200   CONTINUE

      WRITE(LU,*) ' '

      WRITE(LU,*) 'VENUTI'

      IF(LNG.EQ.1) WRITE(LU,*) 'FIN PREMATUREE DU FICHIER DE VENT'

      IF(LNG.EQ.2) WRITE(LU,*) 'WIND FILE TOO SHORT'

      CALL PLANTE(1)

      STOP           

!-----------------------------------------------------------------------

      RETURN

      END

It now seems to give consistent wind input. I can now look into the issue regarding the interpolation between wind file timesteps.

[name removed]

PS. I have noticed a small typographical error in venuti.f. It says

THE USER MAY HAVE TO INTERPOLATE THE TIDES

instead of

THE USER MAY HAVE TO INTERPOLATE THE WIND

You may want to correct that.

Hello,

Thanks for pointing out this, it will be corrected in the next version.

[name removed]

Just an update.

Modifying the NOUDON subroutine so as to bypass the condition that interpolation is carried out only when AT>TV2, does the trick. The wind definition can now be updated/interpolated at every tomawac timestep.

[name removed]

Hello [name removed],

I at last understand the problem : the mechanism of TROUVE is wrong in your case, this is what prevents the interpolation, I have to think of another implementation, e.g. logical values saying if we are reading a file or calling venuti (like I did in the enclosed tentative correction, if OK I can put it in the next release or revision).

Thanks for your efforts,

[name removed]-Michel Hervouet

h6b42bf5.f (11.9 KB)

Hello [name removed],

I used your modification to run my case and compared the results. The wind vectors in your case remain stationary until timestep# 55, at which time the vectors move abruptly and start to coincide with the results in my modification of NOUDON.

The timestep in my case is 5s, which means that the interpolation kicks in at time=250s, which is the second entry in my winds file. Thus, no interpolation is done between the first two entries.

Here is my winds file:

h984e308.txt (298 Bytes)

I will test it thoroughly tomorrow morning.

[name removed]