Compiling error when using AVERAGES_DETIDE in COAWST

Report or discuss software problems and other woes

Moderators: arango, robertson

Post Reply
Message
Author
alazhar
Posts: 18
Joined: Wed Dec 03, 2008 2:06 pm
Location: PML

Compiling error when using AVERAGES_DETIDE in COAWST

#1 Unread post by alazhar »

Dear all,

I get the following error message when compiling COAWST code using AVERAGE_DETIDE cpp option and gfortran compiler:

Code: Select all

 /apps/gcc/installed/bin/gfortran -c -frepack-arrays -fopenmp -O3 -ffast-math -ftree-vectorize -funroll-loops -w -ffree-form -ffree-line-length-none -frecord-marker=4 -fconvert=big-endian set_avg.f90
set_avg.f90:1912.32:

      integer, intent(in) :: NTC
                                1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:1928.30:

      integer, dimension(2*NTC+1) :: indx
                              1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:1931.33:

      real(r8), dimension(0:2*NTC) :: Ak
                                 1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:1932.33:

      real(r8), dimension(0:2*NTC) :: tide_harmonics
                                 1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:1933.33:

      real(r8), dimension(0:2*NTC,0:2*NTC) :: C, Y
                                 1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2009.16:

      NTC2=2*NTC
                1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2021.21:

          DO nk=1,NTC
                     1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2026.23:

            DO mk=1,NTC
                       1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2030.15:

            END DO
               1
Error: Expecting END IF statement at (1)
set_avg.f90:2031.13:

          END DO
             1
Error: Expecting END IF statement at (1)
set_avg.f90:2032.10:

          tide_harmonics(0)=1.0_r8
          1
Error: Unclassifiable statement at (1)
set_avg.f90:2033.21:

          DO nk=1,NTC
                     1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2034.47:

            tide_harmonics(nk    )=SinOmega(nk)
                                               1
Error: Unexpected STATEMENT FUNCTION statement at (1)
set_avg.f90:2035.12:

            tide_harmonics(nk+NTC)=CosOmega(nk)
            1
Error: Unclassifiable statement at (1)
set_avg.f90:2036.13:

          END DO
             1
Error: Expecting END IF statement at (1)
set_avg.f90:2134.21:

          DO nk=1,NTC
                     1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2139.23:

            DO mk=1,NTC
                       1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current program               unit
set_avg.f90:2143.15:

            END DO
               1
Error: Expecting END IF statement at (1)
set_avg.f90:2144.13:

          END DO
             1
Error: Expecting END IF statement at (1)
set_avg.f90:2145.24:

          tide_harmonics(0)=1.0_r8
                        1
Error: 'tide_harmonics' at (1) is not a variable
set_avg.f90:2146.21:

          DO nk=1,NTC
                     1
Error: Name 'ntc' at (1) is an ambiguous reference to 'ntc' from current progr                 unit
set_avg.f90:2147.47:

            tide_harmonics(nk    )=SinOmega(nk)
                                               1
Error: Unexpected STATEMENT FUNCTION statement at (1)
set_avg.f90:2148.26:

            tide_harmonics(nk+NTC)=CosOmega(nk)
                          1
Error: 'tide_harmonics' at (1) is not a variable
set_avg.f90:2149.13:

          END DO
             1
Error: Expecting END IF statement at (1)
set_avg.f90:2261.10:

          C(0,0)=1.0_r8                     ! time-averaged coefficient
          1
Error: Unclassifiable statement at (1)
Fatal Error: Error count reached limit of 25.

Any comments or suggestion on how to solve this error?

Thank you so much in advance!

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: Compiling error when using AVERAGES_DETIDE in COAWST

#2 Unread post by kate »

I can recreate the trouble with gfortran while it compiles with ifort. Does this fix it for you?

Code: Select all

diff --git a/ROMS/Nonlinear/set_avg.F b/ROMS/Nonlinear/set_avg.F
index ce23d65..7e48ce9 100644
--- a/ROMS/Nonlinear/set_avg.F
+++ b/ROMS/Nonlinear/set_avg.F
@@ -5924,7 +5924,7 @@
 #  endif
       USE mod_ocean
       USE mod_scalars
-      USE mod_tides
+      USE mod_tides, only: TIDES
 # ifdef WET_DRY
       USE mod_grid
 # endif

alazhar
Posts: 18
Joined: Wed Dec 03, 2008 2:06 pm
Location: PML

Re: Compiling error when using AVERAGES_DETIDE in COAWST

#3 Unread post by alazhar »

Thank you, Kate. I really appreciate your prompt suggestion. I successfully can compile the code after did your suggestion. However, the following error occurs when I'm trying to run it.

Code: Select all

....
....    
    GET_NGFLD   - tidal period
                   (Min =  4.30820453E+04 Max =  9.67260838E+04)
    GET_2DFLD   - tidal elevation amplitude
                   (Min =  0.00000000E+00 Max =  8.83612468E-01)
    GET_2DFLD   - tidal elevation phase angle
                   (Min =  1.24795852E-04 Max =  6.28306501E+00)
    GET_2DFLD   - tidal current inclination angle
                   (Min =  0.00000000E+00 Max =  6.28318531E+00)
    GET_2DFLD   - tidal current phase angle
                   (Min =  0.00000000E+00 Max =  6.28315957E+00)
    GET_2DFLD   - maximum tidal current, ellipse major axis
                   (Min =  0.00000000E+00 Max =  1.11205056E+00)
    GET_2DFLD   - minimum tidal current, ellipse minor axis
                   (Min = -5.97486219E-03 Max =  3.23017545E-01)

 DEF_VAR - unable to define variable: CosWCosW
           in NetCDF file: /home/amuchamad/Input/roms_tide_1980.nc
....
....
 ROMS/TOMS - Output error ............ exit_flag:   3


 ERROR: Abnormal termination: NetCDF OUTPUT.
 REASON: NetCDF: NC_UNLIMITED in the wrong index
I do not think that variable CosWCosW should be in the tidal forcing file.

Any further suggestion?
Many thanks in advance

lmp4
Posts: 38
Joined: Tue Aug 12, 2014 8:32 pm
Location: Imperial College London

Re: Compiling error when using AVERAGES_DETIDE in COAWST

#4 Unread post by lmp4 »

Hi Alazhar,

I had the exact same issue a few weeks ago with the same error as you have posted upon running it i.e. DEF_VAR - unable to define variable: CosWCosW.

I will refer you to this post which I believe will solve your issue;
viewtopic.php?f=14&t=1370&p=4864&hilit=cosWcosW#p4864

Or to summarize this post; you have to make sure your tidal forcing file has the correct dimensions! For example the "tide_period" dimension should not be defined as UNLIMITED. You can compare your forcing file with CDL templates in the ./Data/ROMS/CDL folder in the standard source code.

Hope this helped.

Post Reply