File indexing completed on 2018-03-02 18:45:40 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
1525958bfa Jean*0001 #include "PACKAGES_CONFIG.h"
aea29c8517 Alis*0002 #include "CPP_OPTIONS.h"
0003
1525958bfa Jean*0004
0005
0006
aea29c8517 Alis*0007 SUBROUTINE INI_THETA( myThid )
1525958bfa Jean*0008
0009
b5c623e9ce Jean*0010
0011
1525958bfa Jean*0012
b5c623e9ce Jean*0013
0014
0015
0016
0017
0018
0019
0020
0021
1525958bfa Jean*0022
0023
0024
0025
aea29c8517 Alis*0026 IMPLICIT NONE
0027
0028
0029 #include "SIZE.h"
0030 #include "EEPARAMS.h"
0031 #include "PARAMS.h"
0032 #include "GRID.h"
0033 #include "DYNVARS.h"
0034
1525958bfa Jean*0035
aea29c8517 Alis*0036
0037
0038 INTEGER myThid
0039
0040
b5c623e9ce Jean*0041
0042
aea29c8517 Alis*0043
1525958bfa Jean*0044
aea29c8517 Alis*0045
0046
0047
0048 INTEGER bi, bj
1525958bfa Jean*0049 INTEGER I, J, K, localWarnings
aea29c8517 Alis*0050 _RL term1,term2,thetaLim,thetaEq
1525958bfa Jean*0051 CHARACTER*(MAX_LEN_MBUF) msgBuf
0052
aea29c8517 Alis*0053
0054 J = 99+myBxLo(myThid)+nPx*myByLo(myThid)
0055
3cd17a95e0 Andr*0056
aea29c8517 Alis*0057
0058 IF ( hydrogThetaFile .EQ. ' ' ) THEN
1525958bfa Jean*0059
aea29c8517 Alis*0060 DO bj = myByLo(myThid), myByHi(myThid)
0061 DO bi = myBxLo(myThid), myBxHi(myThid)
0062 DO K=1,Nr
5375376566 Jean*0063 thetaLim = 200. _d 0/((rC(K)/atm_po)**atm_kappa)
aea29c8517 Alis*0064 DO J=1,sNy
0065 DO I=1,sNx
1525958bfa Jean*0066 term1=60. _d 0*(sin(yC(I,J,bi,bj)*deg2rad)**2)
0067 term2=10. _d 0*log((rC(K)/atm_po))
aea29c8517 Alis*0068 & *(cos(yC(I,J,bi,bj)*deg2rad)**2)
1525958bfa Jean*0069 thetaEq=315. _d 0-term1-term2
aea29c8517 Alis*0070 theta(I,J,K,bi,bj) = MAX( thetaLim, thetaEq )
0071
3cd17a95e0 Andr*0072
aea29c8517 Alis*0073
0074 ENDDO
0075 ENDDO
0076 ENDDO
5375376566 Jean*0077 #ifdef ALLOW_ZONAL_FILT
0078
1525958bfa Jean*0079 IF (useZONAL_FILT) THEN
0080 CALL ZONAL_FILTER(
b5c623e9ce Jean*0081 U theta(1-OLx,1-OLy,1,bi,bj),
0082 I hFacC(1-OLx,1-OLy,1,bi,bj),
0083 I 1, sNy, Nr, bi, bj, 1, myThid )
1525958bfa Jean*0084 ENDIF
0085 #endif /* ALLOW_ZONAL_FILT */
aea29c8517 Alis*0086 ENDDO
0087 ENDDO
0088 ELSE
0089 CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
0090 ENDIF
1525958bfa Jean*0091
0092 localWarnings=0
aea29c8517 Alis*0093 DO bj = myByLo(myThid), myByHi(myThid)
0094 DO bi = myBxLo(myThid), myBxHi(myThid)
0095 DO K=1,Nr
1525958bfa Jean*0096 DO J=1-Oly,sNy+Oly
0097 DO I=1-Olx,sNx+Olx
0098 IF (maskC(I,J,K,bi,bj).EQ.0.) theta(I,J,K,bi,bj) = 0.
aea29c8517 Alis*0099 ENDDO
0100 ENDDO
1525958bfa Jean*0101 IF ( tRef(k).NE.0. ) THEN
0102 DO J=1,sNy
0103 DO I=1,sNx
0104 IF ( maskC(I,J,K,bi,bj).NE.0.
0105 & .AND. theta(I,J,K,bi,bj).EQ.0. ) THEN
0106 localWarnings=localWarnings+1
0107 ENDIF
0108 ENDDO
0109 ENDDO
0110 ENDIF
aea29c8517 Alis*0111 ENDDO
0112 ENDDO
0113 ENDDO
1525958bfa Jean*0114 IF (localWarnings.NE.0) THEN
0115 WRITE(msgBuf,'(A,A)')
0116 & 'S/R INI_THETA: theta = 0 identically. If this is intentional',
0117 & 'you will need to edit ini_theta.F to avoid this safety check'
0118 CALL PRINT_ERROR( msgBuf , myThid)
0119 STOP 'ABNORMAL END: S/R INI_THETA'
0120 ENDIF
aea29c8517 Alis*0121
12ffad7671 Jean*0122 _EXCH_XYZ_RL(theta , myThid )
aea29c8517 Alis*0123
b5c623e9ce Jean*0124 IF (debugMode) THEN
0125 CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' ,
0126 & Nr, 1, myThid )
0127 ENDIF
aea29c8517 Alis*0128
0129 RETURN
0130 END