Commit 83116e8b authored by Gregor Michalicek's avatar Gregor Michalicek

Fixed "floating invalid" error in broyden.F90 (together with Markus B.)

In broyden.F90 sometimes the error floating invalid occured when extensive
runtime checks were enabled. The error occurs in the line were the arrays
sm and sm1 are subtracted from each other.

The conjectured cause for this is that only a part of the arrays is really
used. Their size is larger. The part that is not used is never initialized.
So it may occur that subtracting the arrays from each other results in
an invalid operation in the part of the array that is not used.

We could not directly verify this conjecture. But reducing the subtraction
to the used part seems to cure the problem. We did that and additionally
initialized the local arrays to 0.0.
parent 8968cf74
......@@ -68,6 +68,15 @@ CONTAINS
ALLOCATE (fm1(mmap),sm1(mmap),ui(mmap),um(mmap),vi(mmap),vm(mmap))
ALLOCATE ( am(input%maxiter+1) )
fm1 = 0.0
sm1 = 0.0
ui = 0.0
um = 0.0
vi = 0.0
vm = 0.0
am = 0.0
!
IF (mit.NE.1) THEN
!
......@@ -86,8 +95,8 @@ CONTAINS
! loop to generate F_m - F_(m-1) ... sm1
! and rho_m - rho_(m-1) .. fm1
!
sm1=sm-sm1
fm1=fm-fm1
sm1(1:nmap)=sm(1:nmap)-sm1(1:nmap)
fm1(1:nmap)=fm(1:nmap)-fm1(1:nmap)
END IF
!
! save F_m and rho_m for next iteration
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment