File indexing completed on 2018-03-02 18:45:39 UTC
view on githubraw file Latest commit add29e06 on 2018-01-31 20:35:05 UTC
e9a88bebd8 Patr*0001 #include "PACKAGES_CONFIG.h"
0002 #include "CPP_OPTIONS.h"
0003
0004
0005
0006
0007 SUBROUTINE INI_THETA( myThid )
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
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
0035
0036
0037
0038 INTEGER myThid
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048 INTEGER bi, bj
0049 INTEGER I, J, K, localWarnings
0050 _RL term1,term2,thetaLim,thetaEq
0051 CHARACTER*(MAX_LEN_MBUF) msgBuf
0052
0053
0054 J = 99+myBxLo(myThid)+nPx*myByLo(myThid)
0055
0056
0057
0058 IF ( hydrogThetaFile .EQ. ' ' ) THEN
0059
0060 DO bj = myByLo(myThid), myByHi(myThid)
0061 DO bi = myBxLo(myThid), myBxHi(myThid)
0062 DO K=1,Nr
0063 thetaLim = 200. _d 0/((rC(K)/atm_po)**atm_kappa)
0064 DO J=1,sNy
0065 DO I=1,sNx
0066 term1=60. _d 0*(sin(yC(I,J,bi,bj)*deg2rad)**2)
0067 term2=10. _d 0*log((rC(K)/atm_po))
0068 & *(cos(yC(I,J,bi,bj)*deg2rad)**2)
0069 thetaEq=315. _d 0-term1-term2
0070 theta(I,J,K,bi,bj) = MAX( thetaLim, thetaEq )
0071
0072
0073
0074 ENDDO
0075 ENDDO
0076 ENDDO
0077 #ifdef ALLOW_ZONAL_FILT
0078
0079 IF (useZONAL_FILT) THEN
0080 CALL ZONAL_FILTER(
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 )
0084 ENDIF
0085 #endif /* ALLOW_ZONAL_FILT */
0086 ENDDO
0087 ENDDO
0088 ELSE
0089 CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
0090 ENDIF
0091
0092 localWarnings=0
0093 DO bj = myByLo(myThid), myByHi(myThid)
0094 DO bi = myBxLo(myThid), myBxHi(myThid)
0095 DO K=1,Nr
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.
0099 ENDDO
0100 ENDDO
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
0111 ENDDO
0112 ENDDO
0113 ENDDO
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
0121
0122 _EXCH_XYZ_RL(theta , myThid )
0123
0124 IF (debugMode) THEN
0125 CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' ,
0126 & Nr, 1, myThid )
0127 ENDIF
0128
0129 RETURN
0130 END