Exit early if cost function is negative

Propose new capabilities for ROMS algorithms

Moderators: arango, robertson

Post Reply
Message
Author
stef
Posts: 195
Joined: Tue Mar 13, 2007 6:38 pm
Location: Independent researcher
Contact:

Exit early if cost function is negative

#1 Unread post by stef »

In I4DVAR (I know it's deprecated, but I'm using it to learn), it is possible to obtain negative values for the cost function. This happend to me after I did not #define BGQC and thus accidentally included a bad datapoint in the computation.

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
With corrupt input, the second term on the right hand side can become very large and negative, yielding negative total cost.

Would it make sense to terminate early in that case, since the subsequent computations cannot make any sense?

Post Reply