2013年10月7日月曜日

FABM compilation with gotm-git (Progress 3)

Problem after an attempting to compile FABM:

fabm_standard_variables.F90:205.133:

flux = collection%attenuation_coefficient_of_photosynthetic_radiative_flux
                                                                           1                                                        
Warning: Line truncated at (1)
fabm_standard_variables.F90:206.6:

      cell_thickness = collection%cell_thickness, &
      1
Error: Unclassifiable statement at (1)
fabm_standard_variables.F90:229.133:

_air = collection%surface_downwelling_photosynthetic_radiative_flux_in_air
                                                                           1                                                        
Warning: Line truncated at (1)
fabm_standard_variables.F90:230.6:

      surface_downwelling_shortwave_flux = collection%surface_downwelling_short
      1
Error: Unclassifiable statement at (1)
make: *** [fabm_standard_variables.o] Error 1


I added an extra option in 'compilers/compiler.GFORTRAN':

EXTRAS = -ffree-line-length-135






Then, it works.. Then a new error arises:


Problem:

fabm_types.F90:2325.134:

nk%target%standard_variable,horizontal_link2%target%standard_variable).and. 
                                                                           1                                                           
Error: Syntax error in expression at (1)
fabm_types.F90:2326.44:

                   is_null_standard_variable(horizontal_link2%target%standard_v
                                            1
Error: 'is_null_standard_variable' at (1) is not a variable
fabm_types.F90:1202.30:

subroutine append_string(array,string,exists)
                              1
Error: Dummy 'array' at (1) cannot have an initializer
make: *** [fabm_types.o] Error 1

Solution:

This was actually again related to the length of the statement. So instead of 135, I gave a larger number (e.g. 200) then it was solved.

EXTRAS = -ffree-line-length-200

Alternatively,

EXTRAS = -ffree-line-length-none

is ok too.


What's next?

Problem:

fabm_types.F90:1202.30:

subroutine append_string(array,string,exists)
                              1
Error: Dummy 'array' at (1) cannot have an initializer
make: *** [fabm_types.o] Error 1

Solution:

I modified few lines as follows (!HakaseA is the beginning and !HakaseZ is the end of modifications).

subroutine append_string(array,string,exists)
!HakaseA
!   character(len=attribute_length),dimension(:),_ALLOCATABLE_ :: array _NULL_
   character(len=attribute_length),dimension(:),_ALLOCATABLE_ :: array
!HakaseZ
   character(len=*),intent(in) :: string
   logical,intent(out),optional :: exists
   integer :: i
   character(len=attribute_length),allocatable :: oldarray(:)
   if (.not._ALLOCATED_(array)) then
      allocate(array(1))
   else
      do i=1,size(array)
         if (array(i)==string) then
            if (present(exists)) exists = .true.
            return
         end if
      end do

      allocate(oldarray(size(array)))
      oldarray = array
      deallocate(array)
      allocate(array(size(oldarray)+1))
      array(1:size(oldarray)) = oldarray
      deallocate(oldarray)
   end if

   array(size(array)) = string
   if (present(exists)) exists = .false.
!HakaseA
   nullify(array)
!HakaseZ

I have replaced the position of the nullify(array) command from the previous attempt (http://abdulhaqq09.blogspot.ca/2013/10/fabm-compilation-progress-1.html), which gives a different result. Not sure which would be the right choice.. I switched the position this time based on the fact that nullify(variable) was used twice in this file and both were placed at the end of function.



More and more problems!!


Problem:

npzd.F90:504.200:

elf%id_p%state_index) + (primprod);pp (i__-fabm_loop_start+1,self%id_p%stat
                                                                           1                                                                                                                             
Error: 'stat' at (1) is not a member of the 'type_state_variable_id' structure
npzd.F90:505.200:

elf%id_z%state_index) + (fpz(self,p,z));pp (i__-fabm_loop_start+1,self%id_z
                                                                           1                                                                                                                             
Error: Invalid form of array reference at (1)
npzd.F90:506.200:

elf%id_n%state_index) + (self%rpn*p);pp (i__-fabm_loop_start+1,self%id_n%st
                                                                           1                                                                                                                             
Error: 'st' at (1) is not a member of the 'type_state_variable_id' structure
npzd.F90:507.200:

elf%id_n%state_index) + (self%rzn*z);pp (i__-fabm_loop_start+1,self%id_n%st
                                                                           1                                                                                                                             
Error: 'st' at (1) is not a member of the 'type_state_variable_id' structure
npzd.F90:508.200:

elf%id_n%state_index) + (self%rdn*d);pp (i__-fabm_loop_start+1,self%id_n%st
                                                                           1                                                                                                                             
Error: 'st' at (1) is not a member of the 'type_state_variable_id' structure
npzd.F90:509.200:

elf%id_d%state_index) + (rpd*p);pp (i__-fabm_loop_start+1,self%id_d%state_i
                                                                           1                                                                                                                             
Error: 'state_i' at (1) is not a member of the 'type_state_variable_id' structure
npzd.F90:510.200:

elf%id_d%state_index) + (self%rzd*z);pp (i__-fabm_loop_start+1,self%id_d%st
                                                                           1                                                                                                                             
Error: 'st' at (1) is not a member of the 'type_state_variable_id' structure
make[3]: *** [npzd.o] Error 1
make[3]: Leaving directory `/HOME/hakase/FABM/fabm-git/src/models/gotm/npzd'
make[2]: *** [objs] Error 2
make[2]: Leaving directory `/HOME/hakase/FABM/fabm-git/src/models/gotm'
make[1]: *** [objs] Error 2
make[1]: Leaving directory `/HOME/hakase/FABM/fabm-git/src/models'
make: *** [models] Error 2

Solution:

The problem here again is the length of the statement. I guess '200' is not enough. Maybe better off with the option:

EXTRAS = -ffree-line-length-none




Following http://sourceforge.net/apps/mediawiki/fabm/index.php?title=Obtaining_and_compiling_FABM, I think it is done as it successfully created lib/$(FABMHOST)/$(FORTRAN_COMPILER)/libfabm_prod.a

0 件のコメント:

コメントを投稿