File indexing completed on 2018-03-02 18:40:57 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
65d3db6a48 Jean*0001 #include "GAD_OPTIONS.h"
0002
0003
0004
0005
0006
0007
0008 SUBROUTINE GAD_DIAGNOSTICS_STATE( myTime, myIter, myThid )
0009
0010
0011
0012
0013
0014 IMPLICIT NONE
0015 #include "SIZE.h"
0016 #include "EEPARAMS.h"
0017 #include "PARAMS.h"
0018 #include "GRID.h"
0019 #include "GAD.h"
0020 #include "GAD_SOM_VARS.h"
0021
0022
0023
0024
0025
0026 _RL myTime
0027 INTEGER myIter
0028 INTEGER myThid
0029
0030
0031 #ifdef ALLOW_DIAGNOSTICS
6e23417f74 Jean*0032 #ifdef GAD_ALLOW_TS_SOM_ADV
65d3db6a48 Jean*0033
0034 CHARACTER*4 GAD_DIAG_SUFX
0035 EXTERNAL GAD_DIAG_SUFX
0036 LOGICAL DIAGNOSTICS_IS_ON
0037 EXTERNAL DIAGNOSTICS_IS_ON
0038
0039
0040 CHARACTER*8 diagName
0041 CHARACTER*4 diagSufx
0042 INTEGER i,j,k,bi,bj,n
0043 _RL locVar(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr)
0044 _RL recipVol
0045 _RL oneThird, oneFifth, oneNinth
0046
0047
0048
0049 oneThird = 1. _d 0 / 3. _d 0
0050 oneFifth = 1. _d 0 / 5. _d 0
0051 oneNinth = 1. _d 0 / 9. _d 0
0052
0053
0054 diagSufx = GAD_DIAG_SUFX( GAD_TEMPERATURE, myThid )
0055
0056 DO n=1,nSOM
0057 diagName = 'SM'//somSfx(n)//diagSufx
0058 CALL DIAGNOSTICS_FILL( som_T(1-OLx,1-OLy,1,1,1,n), diagName,
0059 & 0, Nr, 0, 1, 1, myThid )
0060 ENDDO
0061
0062 diagName = 'SM_v'//diagSufx
0063 IF ( DIAGNOSTICS_IS_ON( diagName, myThid ) ) THEN
0064 DO bj = myByLo(myThid), myByHi(myThid)
0065 DO bi = myBxLo(myThid), myBxHi(myThid)
0066
0067
0068 DO k=1,Nr
0069 DO j = 1-OLy,sNy+OLy
0070 DO i = 1-OLx,sNx+OLx
0071 recipVol = recip_rA(i,j,bi,bj)*recip_deepFac2C(k)
0072 & *recip_drF(k)*_recip_hFacC(i,j,k,bi,bj)
0073 & *recip_rhoFacC(k)
0074 locVar(i,j,k) = (
0075 & ( som_T(i,j,k,bi,bj,1)*som_T(i,j,k,bi,bj,1)
0076 & + som_T(i,j,k,bi,bj,2)*som_T(i,j,k,bi,bj,2)
0077 & + som_T(i,j,k,bi,bj,3)*som_T(i,j,k,bi,bj,3)
0078 & )*oneThird
0079 & + ( som_T(i,j,k,bi,bj,4)*som_T(i,j,k,bi,bj,4)
0080 & + som_T(i,j,k,bi,bj,5)*som_T(i,j,k,bi,bj,5)
0081 & + som_T(i,j,k,bi,bj,6)*som_T(i,j,k,bi,bj,6)
0082 & )*oneFifth
0083 & + ( som_T(i,j,k,bi,bj,7)*som_T(i,j,k,bi,bj,7)
0084 & + som_T(i,j,k,bi,bj,8)*som_T(i,j,k,bi,bj,8)
0085 & + som_T(i,j,k,bi,bj,9)*som_T(i,j,k,bi,bj,9)
0086 & )*oneNinth
0087 & )*recipVol*recipVol
0088
0089 ENDDO
0090 ENDDO
0091 ENDDO
0092 CALL DIAGNOSTICS_FILL( locVar, diagName,
0093 & 0, Nr, 2, bi, bj, myThid )
0094 ENDDO
0095 ENDDO
0096 ENDIF
0097
0098
0099 diagSufx = GAD_DIAG_SUFX( GAD_SALINITY, myThid )
0100
0101 DO n=1,nSOM
0102 diagName = 'SM'//somSfx(n)//diagSufx
0103 CALL DIAGNOSTICS_FILL( som_S(1-OLx,1-OLy,1,1,1,n), diagName,
0104 & 0, Nr, 0, 1, 1, myThid )
0105 ENDDO
0106
0107 diagName = 'SM_v'//diagSufx
0108 IF ( DIAGNOSTICS_IS_ON( diagName, myThid ) ) THEN
0109 DO bj = myByLo(myThid), myByHi(myThid)
0110 DO bi = myBxLo(myThid), myBxHi(myThid)
0111
0112
0113 DO k=1,Nr
0114 DO j = 1-OLy,sNy+OLy
0115 DO i = 1-OLx,sNx+OLx
0116 recipVol = recip_rA(i,j,bi,bj)*recip_deepFac2C(k)
0117 & *recip_drF(k)*_recip_hFacC(i,j,k,bi,bj)
0118 & *recip_rhoFacC(k)
0119 locVar(i,j,k) = (
0120 & ( som_S(i,j,k,bi,bj,1)*som_S(i,j,k,bi,bj,1)
0121 & + som_S(i,j,k,bi,bj,2)*som_S(i,j,k,bi,bj,2)
0122 & + som_S(i,j,k,bi,bj,3)*som_S(i,j,k,bi,bj,3)
0123 & )*oneThird
0124 & + ( som_S(i,j,k,bi,bj,4)*som_S(i,j,k,bi,bj,4)
0125 & + som_S(i,j,k,bi,bj,5)*som_S(i,j,k,bi,bj,5)
0126 & + som_S(i,j,k,bi,bj,6)*som_S(i,j,k,bi,bj,6)
0127 & )*oneFifth
0128 & + ( som_S(i,j,k,bi,bj,7)*som_S(i,j,k,bi,bj,7)
0129 & + som_S(i,j,k,bi,bj,8)*som_S(i,j,k,bi,bj,8)
0130 & + som_S(i,j,k,bi,bj,9)*som_S(i,j,k,bi,bj,9)
0131 & )*oneNinth
0132 & )*recipVol*recipVol
0133 ENDDO
0134 ENDDO
0135 ENDDO
0136 CALL DIAGNOSTICS_FILL( locVar, diagName,
0137 & 0, Nr, 2, bi, bj, myThid )
0138 ENDDO
0139 ENDDO
0140 ENDIF
0141
6e23417f74 Jean*0142 #endif /* GAD_ALLOW_TS_SOM_ADV */
65d3db6a48 Jean*0143 #endif /* ALLOW_DIAGNOSTICS */
0144
0145 RETURN
0146 END