In the first inner loop, the cost function is computed as
Code: Select all
! Compute the cost function based on the formula of Tshimanga
! (PhD thesis, p 154, eqn A.15):
!
! J = J_initial + 0.5 * tr
...
FOURDVAR(ng)%CostFun(0)=FOURDVAR(ng)%Cost0(outLoop)+ &
& 0.5_r8*dot(0)*cg_Gnorm(outLoop)anspose(r) Q z
Would it make sense to terminate early in that case, since the subsequent computations cannot make any sense?