Compilation of pCOULWAVE with gfortran

Issues and examples using this model (available in the Models Repository)

Compilation of pCOULWAVE with gfortran

Postby plynett on Fri Aug 26, 2011 11:32 am

Below is a note from Tomas Torsvik - changes below will be incorporated into future versions of the code, but will be needed if you want to run the code in parallel on compilers other than Portland Group.

I downloaded the latest version of pCOULWAVE ( - August 2010) from the web site
yesterday, and successfully compiled the code with gfortran + mpich2-1.3.1. However, I needed to make some modifications in the code in order for the compilation to run without errors and warnings, and I thought you might like some feedback on what I found.
- gfortran doesn't understand 'isnanf', so I changed this to 'isnan'. I understand the use of 'isnanf' is compiler dependent.
- I got complaints that node_1,...,node_8 was defined as real, but used as integer values in do loops, so I changed these to integer variables.
- I got some warnings concerning the use of the 'pause' statement, which apparently ha been deleted in Fortran 95. I changed these statements to
"write(*,*) '...'; stop", which I assume is the intention of these statements.
- gfortran didn't like that a '-' operation was followed directly by a '+' operation in internal_source_type2. I think this may be due to a miss-placed insertion o a comment on line 43 in that file.
- I also found that I needed to specify the compiler flags "-ffixed-line-length-0" and "-ffree-line-length-0" in order for gfortran to read the entire length of the lines. I haven't encountered this problem on other workstations, so I admit this may be a problem with the local version of gfortran (GNU Fortran (Ubuntu 4.4.3-4ubuntu5) 4.4.3) or the way I built mpich2-1.3.1.

Thanks for the good work with maintaining the COULWAVE code!

Best regards,

PS: The following is a log I wrote down during the process:

Changes from source files:
L9: isnanf -> isnan

L119: node_1,node_2, ... ,node_8 are defined as real
Move L119 -> L83, at the end of block of integer allocation.

The PAUSE statement has been deleted in Fortran 95.
Suggested replacement: pause -> write(*,*) '....'; stop This change applies to:
initial_condition.f: L54, L374, L406
tridiagp.f: L104, L109

L43: loc=abs(((x_c- !nint(real(theta/6))*L_spec(freq,theta) !to
spread multi dir spec
L44: - +L_spec(freq,theta)*
Here the '-' sign after x_c in L43 should probably apply to the part that has been removed by the comment, and not the statement on the following line.

Compilation with gfortran + mpich2-1.3.1
F90FLAGS=-O3 -ffixed-line-length-0 -ffree-line-length-0
Posts: 35
Joined: Thu Jul 10, 2008 9:56 am

Re: Compilation of pCOULWAVE with gfortran

Postby hsafti on Mon May 18, 2015 2:49 pm

Dear Prof. Lynett,

Thanks a lot for posting this. I used the instructions here and successfully compiled pCOULWAVE under Ubuntu using gfortran and OpenMPI. I tried to run the 1D_solitary tutorial (no modification to input files and -np 1), but I got an error from the "initial_condition.f" file: the stop statement (if((c2-grav*depth).lt.0.0)). The output from the user interface seems to confirm correct input of parameters.

Were further modifications to the code reported? I would appreciate any pointers to help fix the problem!

Best regards,
Posts: 2
Joined: Mon Jun 28, 2010 9:14 am

Re: Compilation of pCOULWAVE with gfortran

Postby hsafti on Tue May 19, 2015 12:45 am

Dear Prof. Lynett,

I have read a little bit about Fortran and it seems that the "pause" statement should not be replaced by a stop statement that will terminate the program. I replaced the stop statement suggested by Tomas with a print statement, for example:

if((c2-grav*depth).lt.0.0) PRINT*,'since c^2-g*h < 0, no solution'

Now it works :)

All stop statements in initial_conditions.f are similarly modified! Thanks a lot for providing pCOULWAVE!

Best regards,
Posts: 2
Joined: Mon Jun 28, 2010 9:14 am

Return to COULWAVE User Discussions

Who is online

Users browsing this forum: No registered users and 2 guests