Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

compilation error while building code

aketh_t_
Beginner
1,161 Views

Hi,

I have been trying to compile a file with the following variable definitions. And I use the intel 15 set of compilers.

integer (int_kind), parameter :: max_blocks_clinic = 65

.

.

.

.

integer (int_kind) :: nblocks_x=8

integer (int_kind) :: nblocks_y=8

type tlt_info

        real (r8), dimension(nx_block,ny_block,max_blocks_clinic) :: &
           DIABATIC_DEPTH,  &   ! depth of the diabatic region at the
                                !  surface, i.e. mean mixed or boundary layer
                                !  depth
           THICKNESS,       &   ! transition layer thickness
           INTERIOR_DEPTH       ! depth at which the interior, adiabatic
                                !  region starts, i.e.
                                !   = TLT%DIABATIC_DEPTH + TLT%THICKNESS
        integer (int_kind), &
           dimension(nx_block,ny_block,max_blocks_clinic) :: &
           K_LEVEL,  &          ! k level at or below which the interior,
                                !  adiabatic region starts
           ZTW                  ! designates if the interior region
                                !  starts below depth zt or zw.
                                !  ( = 1 for zt, = 2 for zw )
      end type tlt_info

However I got the following error.

loop.F90(55): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [DIABATIC_DEPTH]
           DIABATIC_DEPTH,  &   ! depth of the diabatic region at the
-----------^
loop.F90(58): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [THICKNESS]
           THICKNESS,       &   ! transition layer thickness
-----------^
loop.F90(59): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [INTERIOR_DEPTH]
           INTERIOR_DEPTH       ! depth at which the interior, adiabatic
-----------^
loop.F90(64): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [K_LEVEL]
           K_LEVEL,  &          ! k level at or below which the interior,
-----------^
loop.F90(66): error #6530: The array spec for this component must be of explicit shape and each bound must be an initialization expression.   [ZTW]
           ZTW                  ! designates if the interior region

Any help on how this can be resolved???

0 Kudos
9 Replies
TimP
Honored Contributor III
1,161 Views

Maybe not the best message but how about making each of those integers parameter?

0 Kudos
aketh_t_
Beginner
1,161 Views

I tried it now.

Still the error remains the same. Is it got to do with any flags coz , I have compiled a few files with this definition as a part of CESM. 

0 Kudos
mecej4
Honored Contributor III
1,161 Views

If it is desired that the user defined type contain arrays whose sizes are determined at run-time, make those array components ALLOCATABLE (and perform allocation/deallocation after they are not needed, to save memory footprint), or consider using PDTs (parameterized derived types).

0 Kudos
mecej4
Honored Contributor III
1,161 Views

Aketh T. wrote:
 Is it got to do with any flags
I don't think so. Please provide a (compilable) complete code example.

0 Kudos
aketh_t_
Beginner
1,161 Views

The code size is huge.

I can give a brief pointers about it and a link.

there are two files blocks.F90 (http://www.cesm.ucar.edu/models/cesm1.1/cesm/cesmBbrowser/html_code/pop/blocks.F90.html)

and

hmix_gm.F90 (http://www.cesm.ucar.edu/models/cesm1.0/cesm/cesmBbrowser/html_code/pop/hmix_gm.F90.html)

(try ctrl+F and look for type tlt_info)

These are just a few files that are a part of CESM. I have compiled the entire CESM and run these models, and they work.

0 Kudos
mecej4
Honored Contributor III
1,161 Views

The file blocks.F90 contains declarations for the named constants nx_block and ny_block. In order to use these constants in your declarations, you must have a USE BLOCKS statement in your code, or provide some other way to make these constants known (host association, USE of a module that uses BLOCKS.mod, etc.).

0 Kudos
aketh_t_
Beginner
1,161 Views

Hi I am just trying to simulate loop in hmix_gm rather than the entire hmix_gm.

in this stage all I want to do was copy paste a loop from hmix and definition of variables inside the loop from all the modules present.

0 Kudos
Martyn_C_Intel
Employee
1,161 Views

I agree, I don't see anything to solve here. For example, assuming nblocks_x and nblocks_y to be a typo, and making the corrections discussed above, the following compiles:

module mymod
  integer, parameter :: int_kind=selected_int_kind(8)
  integer, parameter :: r8      =selected_real_kind(12) 
  integer (int_kind), parameter :: max_blocks_clinic = 65
  integer (int_kind), parameter :: nx_block=8
  integer (int_kind), parameter :: ny_block=8

  type tlt_info
        real(r8), dimension(nx_block,ny_block,max_blocks_clinic) :: &
           DIABATIC_DEPTH,  & 
           THICKNESS,       & 
           INTERIOR_DEPTH                                  
                              
        integer(int_kind), &
           dimension(nx_block,ny_block,max_blocks_clinic) :: &
           K_LEVEL,  &      
           ZTW                 
  end type tlt_info

end module

 

0 Kudos
mecej4
Honored Contributor III
1,161 Views

aketh t. wrote:

These are just a few files that are a part of CESM. I have compiled the entire CESM and run these models, and they work. (#6)

Hi I am just trying to simulate loop in hmix_gm rather than the entire hmix_gm. In this stage all I want to do was copy paste a loop from hmix and definition of variables inside the loop from all the modules present. (#8)

Cutting and pasting fragments of code often produces new code that is not compilable. You have modified code from a widely used package -- a package which, presumably, is mostly error-free. The modified code in this instance is not accepted by the compiler, because of syntactic errors.  The fact that similar modifications that you made earlier gave you working code does not guarantee that the present modification is error-free. Therefore, unless you show us your modifications, no progress can be made.

0 Kudos
Reply