Welcome, Guest
Username: Password: Remember me

TOPIC: runcode.py

runcode.py 12 years 1 month ago #5829

  • lootens
  • lootens's Avatar
Hi everybody,

I think I have a propblem with my TELEMAC simulation because of my use of the Python script.Actually I'm running a tidal simulation and I've written a user script in FORTRAN which should normaly write the harmonic constants in a file,but nevertheless nothing is written in this file with Python.While using Perl,there's no problem,the constants are written in the file.Thus I want to know if python allow a user script to write in a file?
Thank you for all ideas to solve the problem.
Regards
Hanna
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5830

  • c.coulet
  • c.coulet's Avatar
  • OFFLINE
  • Moderator
  • Posts: 3722
  • Thank you received: 1031
Hi
Your description is light!
Python or perl manage the simulation but all the fortran modification generate the creation of a specific program which should manage in your case the write in an output file.
Is the fortran program you wrote wele compile in both mode?
How your fortran script look like?
Where did you wrote? in a specific file declared in the telemac steering file?

regards
Christophe
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5831

  • lootens
  • lootens's Avatar
Hi Christophe,

I compiled the Fortran file in both modes without any error message.
The fortran script is a subroutine given in the princi.f of Telemac.It's based on the IMPVEC subroutin (in Bief) .
Regards
Hanna
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5832

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

Ok but where did you wrote the values?
Did you open a specific file and write in it or did you declare a FORMATTED FILE and write directly in it?
Did you check if the file exist in the temp directory?

This is hard to find the solution without any other information

In py opinion, python shouldn't change anything in the write in a file action... but a bug could exist ...
Christophe
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5833

  • riadh
  • riadh's Avatar
Hello Hanna,

Are you running in parallel mode? , in such case, perl and Python do not manage files in the same way.
The routine impvec prints out a vector on the listing. If you want to print a variable in a file, it is better to use the routine PRERES_TELEMAC2D (see flubump validation case). This allows you to obtain the vector in the result file like any other output variable. You can, naturally, print it in the listing also.

With my best regards.
Riadh
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5834

  • lootens
  • lootens's Avatar
Hi,
to Christophe:I open the specific file and write in this file which is located in the parent directory and not in the temp directory because in this directory the file will be deleted after telmac has finished calculating.
Actually the file is created but afterwards the simulation stopps with the error message runcas cas.file failed to run and the file doesn't contain anything.I'll attach the fortran file which I included in my princi.f file for tidal simulation, so you can take a look at it.I know that the way I solved the problem of writing the information I need is not the best,but I'm a beginner in programming.(I didn't forget to modify Bief nor the bief_desimp)

to Riadh:I'm not running in parallel mode.I'm running on Windows Vista 32 bits machine with python 2.7.I want to print out a vector as I'm trying to print out (U,V,H) which are all vectors.

Regards
Hanna

File Attachment:

File Name: impvebj.f
File Size: 2 KB
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5838

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

Ok for this subroutine.
Could you give us more detail on the simulation stop?
You wrote the file was created so i suppose there was another problem...
A copy of the command windows and/or the listing file could give some informations

Regards
Christophe
The administrator has disabled public write access.

runcode.py 12 years 1 month ago #5839

  • lootens
  • lootens's Avatar
Hi Christophe

thank you alot for your help.You are right the file wasn't the problem.I found out that I switched two numbers in the node I wanted to print out and this is why the simulation didn't work.Now it is working and printing correctly as I wish.
Regards
Hanna
The administrator has disabled public write access.
Moderators: pham

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