Opened 8 years ago
Closed 8 years ago
#153 closed defect (fixed)
Spinup problem with initialization of variables and error handling
Reported by: | maignan | Owned by: | maignan |
---|---|---|---|
Priority: | major | Milestone: | ORCHIDEE 1.9.7 |
Component: | Biogeochemical processes | Version: | trunc |
Keywords: | ANALYTICAL SPINUP | Cc: |
Description (last modified by maignan)
In the gauss_jordan_method subroutine, we have:
!! Search the pivot (strategy of full pivoting) !! We search the greatest pivot (in order to reduce errors) DO i = 1,n pivot_max = 0. DO j = 1,n IF(index_pivot(j) /= 1) THEN DO k = 1,n IF(index_pivot(k) .EQ. 0) THEN IF(ABS(matrix_a(j,k)) .GE. pivot_max) THEN pivot_max = ABS(matrix_a(j,k)) row = j col = k ENDIF ENDIF ENDDO ENDIF ENDDO index_pivot(col)=index_pivot(col) + 1 ...
IF all coefficients of matrix A are negative (which theoretically should not happen but indeed has), the variables col and row, which are not properly initialized, may contain any value and thus crash the program if col > n.
Thus:
- row and col have to be initialized (0 value).
- At the end of the loops, at least one of these variables have to be checked, and the code has to be stopped if it is still null.
row = 0 col = 0 !! Search the pivot (strategy of full pivoting) !! We search the greatest pivot (in order to reduce errors) DO i = 1,n pivot_max = 0. DO j = 1,n ... ENDDO IF (col .EQ. 0) THEN CALL ipslerr_p (3,'gauss_jordan_method','Method failed.','','') ENDIF index_pivot(col)=index_pivot(col) + 1 ...
NB: The identification of the failing pixel is not available in this subroutine. Either we add arguments so that this subroutine may print the relevant information or we send back some error status so that the calling subroutine manages the identification of the pixel and the ipslerr_p call.
Change History (5)
comment:1 Changed 8 years ago by jchang
comment:2 Changed 8 years ago by maignan
- Description modified (diff)
- Owner changed from somebody to maignan
- Status changed from new to assigned
comment:3 Changed 8 years ago by maignan
- Status changed from assigned to accepted
comment:4 Changed 8 years ago by maignan
Done in revision [2901].
comment:5 Changed 8 years ago by maignan
- Resolution set to fixed
- Status changed from accepted to closed
There is another possible error at line 78, when declare the integer.
The line:
- INTEGER(r_std)
- i,col,row,j,k,ii,jj !! index (uniltess)
should be modified as: