Welcome, Guest
Username: Password: Remember me

TOPIC: Error using limwac subroutine

Error using limwac subroutine 7 years 2 months ago #27735

  • Papadimitriou
  • Papadimitriou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 80
  • Thank you received: 3
Dear all,following the instructions specifie in this forum (www.opentelemac.org/index.php/assistance...s-boundary-condition) i tried to impose using limwac time varying wave spectrum at the boundary.However when I try to run my model I get the error that is attached at the output_tomawac.txt file.I am also attaching my limwac subroutine the waves file and the systel.cfg file I am using in hope that you can help me once again.

Kind regards,
Andreas
Attachments:
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27736

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Hello Andreas,

The problem is that you are probably using a fortran file from a older version of TOMAWAC. It happens becxause the TELEMAC code was updated and the declaration of the variables LNG (language) and LU (logical unit) are now made in a global module, therefore they cannot appear inside your fortran file. To correct this issue, just comment the lines:
INTEGER LNG,LU
COMMON/INFO/LNG,LU
Although, I highly recommend you to don't do that. This is because the code may have been modified between these versions, and if you do this it may crash somewhere else (I think limwac is the same since V6P3, but just to be sure...).

Instead, take the modifications from your version of limwac and patch them into the current version of the limwac being used by TOMAWAC. This way you assure yourself that the code you are using is up to date and that it will not fail.

Regards,

Phelype
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27737

  • Papadimitriou
  • Papadimitriou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 80
  • Thank you received: 3
Thank you very much for your assistance,I am working on it step by step (even though I have almost no clue about Fortran programming unfortunately).

As I am proceeding I get the following error

runcode::main:
:
|runCode: Fail to run
|C:\Users\andreas\Desktop\aulida_utm_final\tom_sm.cas_2017-09-09-18h50min24s\
out_princi.exe
|~~~~~~~~~~~~~~~~~~
|At line 221 of file wacfort.f (unit = 26, file = 'fort.26')
|Fortran runtime error: End of file

I suppose it has to do with something misread (perhaps dimesnions of the file).
Can I ask you to have a look at my file again and help me with this?

Thank you very much,
Andreas
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27738

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
What is happening now is that you are reading from logical unit 26 (see note), but nowhere in your code you associated LU 26 to a file on the disk.

What you have to do is to add, before the first READ(26,*), an OPEN statement. Something like this:
OPEN(UNIT=26,FILE='/path/to/file.ext',ACTION='READ',STATUS='OLD',FORM='FORMATTED')
In this line:
  • UNIT - is the logical unit
  • FILE - is the relative or absolute path to the file you want to read from
  • ACTION - is what you'll do to the file ('READ' to prevent unintended overwriting of the file). Valid options are 'READ', 'WRITE', and 'READWRITE'
  • STATUS - is the status of the file prior to the program execution. 'OLD' means that the file already existed, 'NEW' means that it will be created, 'SCRATCH' is a temporary file that will be removed once closed, and 'UNKNOWN' is, guess what, unknown :Ρ
  • FORM - is the type of file. 'FORMATTED' is ASCII text, and 'UNFORMATTED' is binary

Write this line according to your needs, and insert it before the first READ statement. I would suggest on line 223, after "IF(LT.LT.1) THEN".

Then, if your file contains the information you are trying to read, it should work fine.

Note: Fortran uses logical units to access files, instead of their names. A logical unit is a positive integer (except for 0, 5, and 6) that points to a file on the computer. The file is associated with the logical unit by the OPEN statement.

Regards,

Phelype
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27739

  • Papadimitriou
  • Papadimitriou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 80
  • Thank you received: 3
Thank you for your help Phelype you have been very explanatory.I seem to have been able to solve the limwac problems but I get a SIGSEV error.I am attaching now my cas geometry and boundary files in hope that maybe you can help me with this error.

Thank you so much for your assistance,
Kind regards,
Andreas
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27740

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
What version of TOMAWAC are you using?

I ran your simulation on V7P2R2 up to the 100th timestep and it worked fine.

Or maybe the problem is with your wind data file (wind_small.slf). Since you didn't upload it I ran the simulation with constant wind.

If you are using TOMAWAC V7P2 too then upload the wind file for me to check.
The administrator has disabled public write access.
The following user(s) said Thank You: Papadimitriou

Error using limwac subroutine 7 years 2 months ago #27741

  • Papadimitriou
  • Papadimitriou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 80
  • Thank you received: 3
here is the wind file.I made the tations .txt format for the forum

Regards,Andreas
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27742

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Very strange...
I ran your simulation without problems, even with the wind file. What version of TOMAWAC are you using?

And what are those other three files for? Are they used to generate the Wind file?

Another question: are you using other fortran subroutine that could be causing the segmentation fault other than limwac?
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27743

  • Papadimitriou
  • Papadimitriou's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 80
  • Thank you received: 3
Dear Phelype.
I am using version 7p2r1.
The other files I attached in the previous post are used to generate the wind file yes.Could the problem be related due to that I haven't installed 7p2v2 yet?
I am using only the limwac subroutine also
The administrator has disabled public write access.

Error using limwac subroutine 7 years 2 months ago #27744

  • Phelype
  • Phelype's Avatar
  • OFFLINE
  • Senior Boarder
  • Posts: 140
  • Thank you received: 64
Okay, I (sort of) figured it out.

Firstly, yes, it is because your version of TOMAWAC is older than mine. I tried running with V7P2R1 and the segmentation fault appeared.
I have absolutely no clue why ¯\_(ツ)_/¯
It shouldn't work on any version. Anyway, let Fortran do its thing...

Don't worry, you don't need (although I recommend) to upgrade to V7P2R2.

Let's go to the problem. You have in your code a few arrays you created (HM0L_PP, FPICL_PP, etc.), and when LT is less than 1 (the initialization of TOMAWAC), you read the input file to these arrays. So far so good.

The problem is that these are local arrays. That is, only LIMWAC knows them, and they have these values only for the current call to LIMWAC. As soon as the program leaves LIMWAC everything is erased.

Then, in the first iteration of TOMAWAC you try to access these arrays to assign the due values to HM0L, FPICL, and TETA1L when AT==AT_PP(K). The problem is that AT_PP is not allocated (not anymore, because it is only allocated when LT < 1).

And when you try to access the Kth value of AT_PP (that doesn't exist) the program throws the vile Segmentation Fault at you.

How to solve the problem? Tell Fortran to keep these arrays to subsequent calls to the subroutine.

To do that just add a SAVE statement with the name of the variables you want to save after their declaration (on line 137):
!     #################################################################
!     THESE ARE THE VARIABLES INTRODUCED BY PAT PRODANOVIC
      DOUBLE PRECISION,DIMENSION(:), ALLOCATABLE :: HM0L_PP,FPICL_PP
      DOUBLE PRECISION,DIMENSION(:), ALLOCATABLE :: TETA1L_PP
      INTEGER, DIMENSION(:), ALLOCATABLE :: AT_PP
      INTEGER NO_TIME_POINTS,K
      SAVE HM0L_PP,FPICL_PP,TETA1L_PP,AT_PP,NO_TIME_POINTS !! SAVING THE VARIABLES FOR FURTHER CALLS
!     #################################################################

Simple as that!

Hope this clarifies you a little about Fortran. It is quite likeable when you become friends with him.

Best regards,

Phelype
The administrator has disabled public write access.
The following user(s) said Thank You: Papadimitriou
Moderators: tfouquet

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