Welcome, Guest
Username: Password: Remember me

TOPIC: running or stopping the code at any desirable line of the fortran file

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37356

  • nitesh
  • nitesh's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 1
Hello,

I started recently using Telemac-2D for rainfall-runoff modelling.
To start the simulation, I open the TELEMAC v8p0 parallel terminal, go to the simulation folder and write "telemac2d.py -s simulation_file.cas", and the simulation starts and I get the results after the simulation is finished.
As I am quite new to Telemac, this may be a very basic question but I want to run the "runoff_scs_cn.f" file line by line so that I am able to stop the simulation at any desirable line of the code to see what each line is doing and what will happen if I do some changes into it or introduce some new variables.

Can anyone please suggest me some way to do it?

Thanks in advance:)
Attachments:
The administrator has disabled public write access.

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37358

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

You need to use a debugger (dor example gdb).
Have a look at the following link:
undo.io/resources/debugging-fortran-code-gdb/

For telemac the executable is in the temporary folder.
So to debug you need to run somthing like that:
telemac2d.py -w tmp simulation.cas --split
telemac2d.py -w tmp simulation.cas -x
cd tmp
gdb ./out_telemac2d
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.
The following user(s) said Thank You: nitesh

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37359

  • pilou1253
  • pilou1253's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 584
  • Thank you received: 106
Hello,

If you really want to follow what the routine does line by line then is can be a good idea to do what yugi suggests.

Just a comment: I am the author of this routine and the abstraction calculation is based on a carbon copy of the methodology reviewed in the following book:

APPLIED HYDROLOGY by CHOW, MAIDMENT, MAYS, McGraw-Hill Publishing 1988

You might find in it a clearer description of the calculation than trying to understand its FORTRAN implementation. By the way, it is a very good allround book about hydrological processes and even more, I highly recommend it. A must-read for engineers in the field of surface water problems ;-)

Kind regards
PL
The administrator has disabled public write access.
The following user(s) said Thank You: nitesh

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37369

  • nitesh
  • nitesh's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 1
Thank you so much yugi and pilou for your quick response.
I agree with you pilou, this is a very important book for a hydrologist to understand basic hydrology concepts. And now I want to introduce new things and methods in this routine and for that I have to have good command on running the code too :).

For yugi: I have installed GDB in windows but have never used gdb before, so I have few basic questions for which I could not find answers anywhere else.
I assume that gdb will run in windows command prompt. Does gdb work while the simulation is already running in the Telemac terminal or after the simulation is finished?
Also, what does the first and second line mean and where do I run this? In cmd Windows or in Telemac terminal?

telemac2d.py -w tmp simulation.cas --split
telemac2d.py -w tmp simulation.cas -x
cd tmp
gdb ./out_telemac2d


Thanks!
The administrator has disabled public write access.

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37371

  • yugi
  • yugi's Avatar
  • OFFLINE
  • openTELEMAC Guru
  • Posts: 851
  • Thank you received: 244
gdb is launched before.

The line I gave you are doing the following:

- Building the temporary folder copying files... (telemac2d.py -w tmp simulation.cas --split)
- Compiling user fortan if there is one copying executable otherwise (telemac2d.py -w tmp simulation.cas -x)
- Moving into temporary folder (cd tmp) chdir tmp (in windows)
- Running gdb (gdb ./out_telemac2d.exe)

Everything should be run in Telemac Terminal (you need the telemac ennvironement).
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.
The following user(s) said Thank You: nitesh

running or stopping the code at any desirable line of the fortran file 3 years 11 months ago #37407

  • nitesh
  • nitesh's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 1
Hi Yugi, I tried "gdb ./out_telemac2d" but it says:

No such file or directory.

Is the reason for this is the different location of them, as the telemac2d.exe is in C:\opentelemac-mascaret\v8p0\builds\wing64mpi\bin and the temp folder is in D:\Nitesh\test_scenario1\tmp ?
if yes, should I move one of this to the another's location?

Thanks!
The administrator has disabled public write access.

running or stopping the code at any desirable line of the fortran file 3 years 10 months ago #37498

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

Are you not missing the .exe ?
Have a look in the tmp folder to check the name of the executable.
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.
The following user(s) said Thank You: nitesh

running or stopping the code at any desirable line of the fortran file 3 years 10 months ago #37562

  • nitesh
  • nitesh's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 1
Hi,

I thought that too, and I found that the only .exe I have in this folder is named "out_user_fortran-cn_geo_hyetograph"
so I ran the command by replacing "telemac.exe" with this name. And it worked a little but it stopped with "Fortran runtime error: Bad integer for item 1 in list input", which I am not really getting.

When I run "telemac2d.py -s simulation_file.cas" as before i.e. without temp folder and gdb, it's not getting any error.
I have added the images of the temp folder and the telemac terminal, if it helps.
Attachments:
The administrator has disabled public write access.

running or stopping the code at any desirable line of the fortran file 3 years 10 months ago #37570

  • nitesh
  • nitesh's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 73
  • Thank you received: 1
Hi,

The T2DSEC file has the control sections coordinates as follows:

# control sections: number of xs, -1 nodes +1 coordinates
2 +1
Station
3927,874 3896,888
outflow
5230,812 5254,784


I thought the "," were the problems so to convert the values to real ones I replaced all the "," with "."

but now I am getting the same error but at another line of the .f file.

Can you please help me to find what is the problem?
Attached are the images including error and read_sections_telemac2d.f

Thanks!
Attachments:
The administrator has disabled public write access.

running or stopping the code at any desirable line of the fortran file 3 years 10 months ago #37572

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi

Are you sure of the section input file ?
In the manual, they are not described in this way...

Regards
Christophe
The administrator has disabled public write access.
Moderators: pham

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