391 |
c-- (D): calculate relative differences between gradients |
c-- (D): calculate relative differences between gradients |
392 |
c****************************************************** |
c****************************************************** |
393 |
|
|
394 |
|
if ( grdchk_eps .eq. 0. ) then |
395 |
|
gfd = (fcpertplus-fcpertminus) |
396 |
|
else |
397 |
|
gfd = (fcpertplus-fcpertminus) |
398 |
|
& /(grdchk_epsfac*grdchk_eps) |
399 |
|
endif |
400 |
|
|
401 |
|
if ( adxxmemo .eq. 0. ) then |
402 |
|
ratio_ad = abs( adxxmemo - gfd ) |
403 |
|
else |
404 |
|
ratio_ad = 1. - gfd/adxxmemo |
405 |
|
endif |
406 |
|
|
407 |
|
if ( ftlxxmemo .eq. 0. ) then |
408 |
|
ratio_ftl = abs( ftlxxmemo - gfd ) |
409 |
|
else |
410 |
|
ratio_ftl = 1. - gfd/ftlxxmemo |
411 |
|
endif |
412 |
|
|
413 |
if ( myProcId .EQ. grdchkwhichproc .AND. |
if ( myProcId .EQ. grdchkwhichproc .AND. |
414 |
& ierr .EQ. 0 ) then |
& ierr .EQ. 0 ) then |
415 |
|
|
|
if ( grdchk_eps .eq. 0. ) then |
|
|
gfd = (fcpertplus-fcpertminus) |
|
|
else |
|
|
gfd = (fcpertplus-fcpertminus) |
|
|
& /(grdchk_epsfac*grdchk_eps) |
|
|
endif |
|
|
|
|
|
if ( adxxmemo .eq. 0. ) then |
|
|
ratio_ad = abs( adxxmemo - gfd ) |
|
|
else |
|
|
ratio_ad = 1. - gfd/adxxmemo |
|
|
endif |
|
|
|
|
|
if ( ftlxxmemo .eq. 0. ) then |
|
|
ratio_ftl = abs( ftlxxmemo - gfd ) |
|
|
else |
|
|
ratio_ftl = 1. - gfd/ftlxxmemo |
|
|
endif |
|
|
|
|
416 |
tmpplot1(itilepos,jtilepos,layer,itile,jtile) |
tmpplot1(itilepos,jtilepos,layer,itile,jtile) |
417 |
& = gfd |
& = gfd |
418 |
tmpplot2(itilepos,jtilepos,layer,itile,jtile) |
tmpplot2(itilepos,jtilepos,layer,itile,jtile) |
474 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE |
475 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,myThid) |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,myThid) |
476 |
#else |
#else |
477 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A30,1PE22.14)') |
478 |
& ' ADM precision_derivative_cost =', fcref |
& ' ADM ref_cost_function =', fcref |
479 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
480 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,myThid) |
& SQUEEZE_RIGHT, myThid ) |
481 |
WRITE(msgBuf,'(A34,1PE24.14)') |
WRITE(msgBuf,'(A30,1PE22.14)') |
482 |
& ' ADM precision_derivative_grad =', adxxmemo |
& ' ADM adjoint_gradient =', adxxmemo |
483 |
CALL PRINT_MESSAGE |
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
484 |
& (msgBuf,standardMessageUnit,SQUEEZE_RIGHT,myThid) |
& SQUEEZE_RIGHT, myThid ) |
485 |
|
WRITE(msgBuf,'(A30,1PE22.14)') |
486 |
|
& ' ADM finite-diff_grad =', gfd |
487 |
|
CALL PRINT_MESSAGE( msgBuf, standardMessageUnit, |
488 |
|
& SQUEEZE_RIGHT, myThid ) |
489 |
#endif |
#endif |
490 |
|
|
491 |
print *, 'ph-grd ierr ---------------------------' |
print *, 'ph-grd ierr ---------------------------' |