150 |
c-- initialise variables |
c-- initialise variables |
151 |
call grdchk_init( mythid ) |
call grdchk_init( mythid ) |
152 |
|
|
153 |
c-- Compute the adjoint models' gradients. |
c-- Compute the adjoint model gradients. |
154 |
c-- Compute the unperturbed cost function. |
c-- Compute the unperturbed cost function. |
155 |
cph Gradient via adjoint has already been computed, |
cph Gradient via adjoint has already been computed, |
156 |
cph and so has unperturbed cost function, |
cph and so has unperturbed cost function, |
157 |
cph assuming all xx_ fields are initialised to zero. |
cph assuming all xx_ fields are initialised to zero. |
158 |
|
|
159 |
|
ierr = 0 |
160 |
ierr_grdchk = 0 |
ierr_grdchk = 0 |
161 |
|
adxxmemo = 0. |
162 |
|
ftlxxmemo = 0. |
163 |
#ifdef ALLOW_ADMTLM |
#ifdef ALLOW_ADMTLM |
164 |
fcref = objf_state_final(idep,jdep,1,1,1) |
fcref = objf_state_final(idep,jdep,1,1,1) |
165 |
#else |
#else |
253 |
c****************************************************** |
c****************************************************** |
254 |
c-- |
c-- |
255 |
c-- 1. perturb control vector component: xx(i)=1. |
c-- 1. perturb control vector component: xx(i)=1. |
|
ftlxxmemo = 0. |
|
256 |
|
|
257 |
if ( myProcId .EQ. grdchkwhichproc .AND. |
if ( myProcId .EQ. grdchkwhichproc .AND. |
258 |
& ierr .EQ. 0 ) then |
& ierr .EQ. 0 ) then |
461 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
462 |
c |
c |
463 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A34,1PE24.14)') |
464 |
& 'precision_derivative_cost TLM ', fcref |
& ' TLM precision_derivative_cost =', fcref |
465 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE |
466 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
467 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A34,1PE24.14)') |
468 |
& 'precision_derivative_grad TLM ', ftlxxmemo |
& ' TLM precision_derivative_grad =', ftlxxmemo |
469 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE |
470 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
471 |
#else |
#else |
474 |
& icompmem(ichknum),itestmem(ichknum), |
& icompmem(ichknum),itestmem(ichknum), |
475 |
& bimem(ichknum),bjmem(ichknum),obcspos, |
& bimem(ichknum),bjmem(ichknum),obcspos, |
476 |
& adxxmemo, gfd, ratio_ad |
& adxxmemo, gfd, ratio_ad |
477 |
WRITE(msgBuf,'(A34,2(1PE24.14,X))') |
c WRITE(msgBuf,'(A34,2(1PE24.14,X))') |
478 |
& 'precision_grdchk_result ADM ', fcref, adxxmemo |
c & 'precision_grdchk_result ADM ', fcref, adxxmemo |
479 |
CALL PRINT_MESSAGE |
c CALL PRINT_MESSAGE |
480 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
c & (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
|
c |
|
481 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A34,1PE24.14)') |
482 |
& 'precision_derivative_cost ADM ', fcref |
& ' ADM precision_derivative_cost =', fcref |
483 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE |
484 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
485 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A34,1PE24.14)') |
486 |
& 'precision_derivative_grad ADM ', ftlxxmemo |
& ' ADM precision_derivative_grad =', adxxmemo |
487 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE |
488 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,1) |
489 |
#endif |
#endif |