NCAR / DART

Data Assimilation Research Testbed
https://dart.ucar.edu/
Apache License 2.0
184 stars 139 forks source link

bug: findloc doesn't have a type #629

Closed joeailvyou closed 5 months ago

joeailvyou commented 5 months ago

Describe the bug

  1. /DART/assimilation_code/modules/assimilation/normal_distribution_mod.f90 was added since V11.0.0, but normal_distribution_mod.f90 has a bug : /DART-main/assimilation_code/modules/assimilation/normal_distribution_mod.f90(497): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [X_OUT] subroutine inv_cdf_quadrature_like(quantiles, ens, likelihood, ens_size, cdf, p, x_out)
  2. /DART/assimilation_code/modules/assimilation/algorithm_info_mod.f90 was added since since V11.0.0,but algorithm_info_mod.f90 has a bug: /DART_Tags/DART-11.0.0/assimilation_code/modules/assimilation/algorithm_info_mod.f90(346): error #6404: This name does not have a type, and must have an explicit type. [FINDLOC] QTY_loc = findloc(specified_qtys, obs_qty)
  3. These two bugs occured while I compile the case /DART/models/lorenz_63/work . In VERSION V10.10.1 and earlier VERSION, lorenz63 can be compiled successfully. The steps to reproduce the bug is to run ./quickbuild.sh in the directory /DART/models/lorenz63/work.

Error Message

The detail of the bug was as following : /public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/normal_distribution_mod.f90(497): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [X_OUT] subroutine inv_cdf_quadrature_like(quantiles, ens, likelihood, ens_size, cdf, p, x_out) ---------------------------------------------------------------------------------^

mpif90 -O -assume buffered_io -I/public/home/JCZ11634027/system/software9_mpich/netcdf-4.5.0-intel/include -I/public/home/JCZ11634027/system/software9_mpich/netcdf-fortran-4.4.4-intel/include -c /public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/bnrh_distribution_mod.f90

mpif90 -O -assume buffered_io -I/public/home/JCZ11634027/system/software9_mpich/netcdf-4.5.0-intel/include -I/public/home/JCZ11634027/system/software9_mpich/netcdf-fortran-4.4.4-intel/include -c /public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/algorithm_info_mod.f90

/public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/algorithm_info_mod.f90(346): error #6404: This name does not have a type, and must have an explicit type. [FINDLOC] QTY_loc = findloc(specified_qtys, obs_qty) ----------^

/public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/algorithm_info_mod.f90(406): error #6404: This name does not have a type, and must have an explicit type. [FINDLOC] QTY_loc = findloc(specified_qtys, qty) ----------^

/public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/algorithm_info_mod.f90(469): error #6404: This name does not have a type, and must have an explicit type. [FINDLOC] QTY_loc = findloc(specified_qtys, obs_qty) ----------^

compilation aborted for /public/home/JCZ11634027/Documents/packages/DART-main/assimilation_code/modules/assimilation/algorithm_info_mod.f90 (code 1) make: *** [algorithm_info_mod.o] Error 1

Which model(s) are you working with?

Quickstart case /DART/models/lorenz_63/work.

Screenshots

![Uploading image.png…]()

Version of DART

Bugs occured since V11.0.0. I mean, V11.0.0, V11.0.1, V11.1.0 and the latest version all have such bugs.

Have you modified the DART code?

No !!!

Build information

  1. The machine I am running on : Red Hat Enterprise Linux Server release 7.4.
  2. The compiler I am using intel 15.0.2 20150121.
joeailvyou commented 5 months ago

Screenshots 2-bug-report

hkershaw-brown commented 5 months ago

Hi @joeailvyou

intel 15.0.2 20150121 is quite an old compiler (~10 years old now) findloc is a Fortan intrinsic introduced in the 2008 standard. If you can, I would recommend you move to a newer version of the intel compile If you can't get a new version of the intel compiler, you can add findloc as a subroutine in DART/assimilation_code/modules/assimilation/algorithm_info_mod.f90 module

!------------------------------------------------------------------------
! if findloc is not available from the compiler
function findloc(arr, val)

integer, intent(in) :: arr(:)  ! array to search
integer, intent(in) :: val     ! value to search for
integer :: findloc(1)

integer :: i

do i = 1, size(arr)
  if (arr(i) == val) then
     findloc = i 
     return
  endif
enddo

findloc = 0 ! not found

end function findloc
!------------------------------------------------------------------------
  1. Is a warning, this will not stop dart from compiling.

Cheers, Helen

joeailvyou commented 5 months ago

Hi @joeailvyou

intel 15.0.2 20150121 is quite an old compiler (~10 years old now) findloc is a Fortan intrinsic introduced in the 2008 standard. If you can, I would recommend you move to a newer version of the intel compile If you can't get a new version of the intel compiler, you can add findloc as a subroutine in DART/assimilation_code/modules/assimilation/algorithm_info_mod.f90 module

!------------------------------------------------------------------------
! if findloc is not available from the compiler
function findloc(arr, val)

integer, intent(in) :: arr(:)  ! array to search
integer, intent(in) :: val     ! value to search for
integer :: findloc(1)

integer :: i

do i = 1, size(arr)
  if (arr(i) == val) then
     findloc = i 
     return
  endif
enddo

findloc = 0 ! not found

end function findloc
!------------------------------------------------------------------------
  1. Is a warning, this will not stop dart from compiling.

Cheers, Helen

Dear Helen, Thank you for your timely reply and effective solutions. It works! Thank you very much. Best wishes! Joe Smith

hkershaw-brown commented 5 months ago

no problem, thanks for reporting this - it is good to hear experience from users. I'm going to go ahead and close this issue.

Cheers, Helen

joeailvyou commented 5 months ago

no problem, thanks for reporting this - it is good to hear experience from users. I'm going to go ahead and close this issue.

Cheers, Helen

Wait a minute, the function findloc should be: ` !------------------------------------------------------------------------ ! if findloc is not available from the compiler function findloc(arr, val)

integer, intent(in) :: arr(:) ! array to search integer, intent(in) :: val ! value to search for integer :: findloc(1)

integer :: i

findloc = 0 ! not found

do i = 1, size(arr) if (arr(i) == val) then findloc = i return endif enddo

end function findloc !------------------------------------------------------------------------` findloc = 0 ! not found should be placed ahead the loop, right ?

hkershaw-brown commented 5 months ago

I believe either before or after works. The code should do the following:

if val is found, return i If val is not found return 0 (not found)

joeailvyou commented 5 months ago

I believe either before or after works. The code should do the following:

if val is found, return i If val is not found return 0 (not found)

Dear Helen, Thank you for you patience and detailed answer.

Wish you good health and happiness. Joe Smith