Back to home page

MITgcm

 
 

    


File indexing completed on 2023-09-21 05:10:50 UTC

view on githubraw file Latest commit 96b00645 on 2023-09-20 15:15:14 UTC
2be4afbb6e Dani*0001 #include "STREAMICE_OPTIONS.h"
                0002 #ifdef ALLOW_AUTODIFF
                0003 # include "AUTODIFF_OPTIONS.h"
                0004 #endif
                0005 
                0006 C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----|
                0007 
                0008 CBOP
                0009       SUBROUTINE STREAMICE_GET_VEL_RESID_ERR_OAD ( err_max, myThid )
                0010 C     /============================================================\
                0011 C     | SUBROUTINE                                                 |
                0012 C     | o                                                          |
                0013 C     |============================================================|
                0014 C     |                                                            |
                0015 C     \============================================================/
                0016       IMPLICIT NONE
                0017 
                0018 C     === Global variables ===
                0019 #include "SIZE.h"
                0020 #include "EEPARAMS.h"
                0021 #include "PARAMS.h"
                0022 #include "STREAMICE.h"
                0023 #include "STREAMICE_CG.h"
                0024 
                0025 C     !INPUT/OUTPUT ARGUMENTS
                0026       _RL err_max
                0027       INTEGER myThid
                0028 
                0029 #ifdef ALLOW_STREAMICE
351fd6b6a4 Dani*0030 #if (defined (ALLOW_STREAMICE_OAD_FP))
2be4afbb6e Dani*0031 
                0032       INTEGER conv_flag, i, j, bi, bj, myIter
96b006450c dngo*0033       Real*8 u_dummy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0034       Real*8 v_dummy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
                0035       _RL err_sum
                0036       _RL err_sum_tile (nSx,nSy)
351fd6b6a4 Dani*0037 
2be4afbb6e Dani*0038       INTEGER ikey_nl
                0039       _RL err_tempu, err_tempv
                0040       _RL max_vel, tempu, tempv, err_lastchange, cgtol
                0041       CHARACTER*(MAX_LEN_MBUF) msgBuf
                0042       LOGICAL isTape
                0043 
bbd6229661 Dani*0044        err_max = 0. _d 0
                0045        err_sum = 0. _d 0
                0046 
                0047        DO bj = myByLo(myThid), myByHi(myThid)
                0048         DO bi = myBxLo(myThid), myBxHi(myThid)
96b006450c dngo*0049          err_sum_tile(bi,bj) = 0. _d 0
bbd6229661 Dani*0050         ENDDO
                0051        ENDDO
2be4afbb6e Dani*0052 
                0053         DO bj = myByLo(myThid), myByHi(myThid)
                0054          DO bi = myBxLo(myThid), myBxHi(myThid)
96b006450c dngo*0055           DO j=1-OLy,sNy+OLy
                0056            DO i=1-OLx,sNx+OLx
2be4afbb6e Dani*0057             Au_SI (i,j,bi,bj) = 0. _d 0
                0058             Av_SI (i,j,bi,bj) = 0. _d 0
351fd6b6a4 Dani*0059             u_dummy (i,j,bi,bj) = u_streamice(i,j,bi,bj)
                0060             v_dummy (i,j,bi,bj) = v_streamice(i,j,bi,bj)
2be4afbb6e Dani*0061             ubd_SI (i,j,bi,bj) = 0. _d 0
                0062             vbd_SI (i,j,bi,bj) = 0. _d 0
                0063            ENDDO
                0064           ENDDO
                0065          ENDDO
                0066         ENDDO
                0067 
                0068         CALL STREAMICE_CG_BOUND_VALS( myThid,
                0069      O    ubd_SI,
                0070      O    vbd_SI)
                0071 
                0072         CALL STREAMICE_CG_ACTION( myThid,
                0073      O    Au_SI,
                0074      O    Av_SI,
351fd6b6a4 Dani*0075      I    U_dummy,
                0076      I    V_dummy,
2be4afbb6e Dani*0077      I    0, sNx+1, 0, sNy+1 )
                0078 
                0079         DO bj = myByLo(myThid), myByHi(myThid)
                0080          DO bi = myBxLo(myThid), myBxHi(myThid)
                0081           DO j=1,sNy
                0082            DO i=1,sNx
                0083             err_tempu = 0. _d 0
                0084             err_tempv = 0. _d 0
                0085             IF (STREAMICE_umask(i,j,bi,bj).eq.1) THEN
                0086              err_tempu =
                0087      &        ABS (Au_SI(i,j,bi,bj)+0*ubd_SI(i,j,bi,bj) -
                0088      &            taudx_SI(i,j,bi,bj))
                0089             ENDIF
                0090             IF (STREAMICE_vmask(i,j,bi,bj).eq.1) THEN
                0091              err_tempv = MAX( err_tempu,
                0092      &        ABS (Av_SI(i,j,bi,bj)+0*vbd_SI(i,j,bi,bj) -
                0093      &            taudy_SI(i,j,bi,bj)))
                0094             ENDIF
                0095             IF (err_tempv .ge. err_max) THEN
                0096              err_max = err_tempv
                0097             ENDIF
                0098            ENDDO
                0099           ENDDO
                0100          ENDDO
                0101         ENDDO
                0102 
                0103         CALL GLOBAL_MAX_R8 (err_max, myThid)
                0104 
                0105 #endif
                0106 #endif
                0107       RETURN
                0108       END