/[MITgcm]/MITgcm/verification/advect_xy/code/ini_theta.F
ViewVC logotype

Contents of /MITgcm/verification/advect_xy/code/ini_theta.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Mon Jan 18 19:42:10 2010 UTC (11 years, 10 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62c, checkpoint62g, checkpoint62f, checkpoint62e, checkpoint62d, checkpoint62k, checkpoint62j, checkpoint62i, checkpoint62h, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x, checkpoint64, checkpoint65, checkpoint63, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint65o, checkpoint62b, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, HEAD
Changes since 1.3: +72 -54 lines
- closer to standard version (from model/src)
- add "_d 0" (more robust when RS is real*4)

1 C $Header: /u/gcmpack/MITgcm/verification/advect_xy/code/ini_theta.F,v 1.3 2009/04/28 18:06:14 jmc Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: INI_THETA
8 C !INTERFACE:
9 SUBROUTINE INI_THETA( myThid )
10 C !DESCRIPTION: \bv
11 C *==========================================================*
12 C | SUBROUTINE INI_THETA
13 C | o Set model initial temperature field.
14 C *==========================================================*
15 C | There are several options for setting the initial
16 C | temperature file
17 C | 1. Inline code
18 C | 2. Vertical profile ( uniform T in X and Y )
19 C | 3. Three-dimensional data from a file. For example from
20 C | Levitus or from a checkpoint file from a previous
21 C | integration.
22 C | In addition to setting the temperature field we also
23 C | set the initial temperature tendency term here.
24 C *==========================================================*
25 C \ev
26
27 C !USES:
28 IMPLICIT NONE
29 C === Global variables ===
30 #include "SIZE.h"
31 #include "EEPARAMS.h"
32 #include "PARAMS.h"
33 #include "GRID.h"
34 #include "DYNVARS.h"
35
36 C !INPUT/OUTPUT PARAMETERS:
37 C == Routine arguments ==
38 C myThid :: Number of this instance of INI_THETA
39 INTEGER myThid
40
41 C !LOCAL VARIABLES:
42 C == Local variables ==
43 C bi,bj :: Tile indices
44 C i,j,k :: Loop counters
45 C rD :: Radial displacement of point i,j
46 INTEGER bi, bj
47 INTEGER i, j, k, localWarnings
48 _RL Tfreezing
49 _RL rD
50 CHARACTER*(MAX_LEN_MBUF) msgBuf
51 CEOP
52
53 C-- Initialise temperature field to the vertical reference profile
54 DO bj = myByLo(myThid), myByHi(myThid)
55 DO bi = myBxLo(myThid), myBxHi(myThid)
56 DO k=1,Nr
57 DO j=1-Oly,sNy+Oly
58 DO i=1-Olx,sNx+Olx
59 theta(i,j,k,bi,bj) = tRef(k)
60 ENDDO
61 ENDDO
62 C=== Set-up specific modification starts here ===
63 C-- Initialise temperature field to a circular patch.
64 DO j=1,sNy
65 DO i=1,sNx
66 rD = SQRT( ( xC(i,j,bi,bj) - 40. _d 3 )**2
67 & +( yC(i,j,bi,bj) - 40. _d 3 )**2
68 & +( rC(k) + 50. _d 3 )**2
69 & )
70 theta(i,j,k,bi,bj) = EXP( -0.5 _d 0*( rD/20. _d 3 )**2 )
71 ENDDO
72 ENDDO
73 C=== Set-up specific modification ends here ===
74 ENDDO
75 ENDDO
76 ENDDO
77 C=== Set-up specific modification starts here ===
78 _EXCH_XYZ_RL( theta, myThid )
79 C=== Set-up specific modification ends here ===
80
81 IF ( hydrogThetaFile .NE. ' ' ) THEN
82 CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
83 _EXCH_XYZ_RL(theta,myThid)
84 ENDIF
85
86 C-- Apply mask and test consistency
87 localWarnings=0
88 DO bj = myByLo(myThid), myByHi(myThid)
89 DO bi = myBxLo(myThid), myBxHi(myThid)
90 DO k=1,Nr
91 IF ( maskIniTemp ) THEN
92 DO j=1-Oly,sNy+Oly
93 DO i=1-Olx,sNx+Olx
94 IF (maskC(i,j,k,bi,bj).EQ.0.) theta(i,j,k,bi,bj) = 0.
95 ENDDO
96 ENDDO
97 ENDIF
98 IF ( tRef(k).NE.0. ) THEN
99 DO j=1,sNy
100 DO i=1,sNx
101 IF ( maskC(i,j,k,bi,bj).NE.0.
102 & .AND. theta(i,j,k,bi,bj).EQ.0. ) THEN
103 localWarnings=localWarnings+1
104 ENDIF
105 ENDDO
106 ENDDO
107 ENDIF
108 ENDDO
109 ENDDO
110 ENDDO
111 IF (localWarnings.NE.0) THEN
112 IF ( checkIniTemp ) THEN
113 WRITE(msgBuf,'(A,I10,A)')
114 & ' INI_THETA: found', localWarnings,
115 & ' wet grid-pts with theta=0 identically.'
116 CALL PRINT_ERROR( msgBuf , myThid)
117 WRITE(msgBuf,'(A,A)')
118 & ' If this is intentional, you need to',
119 & ' set checkIniTemp=.false. in "data", namelist PARM05'
120 CALL PRINT_ERROR( msgBuf , myThid)
121 STOP 'ABNORMAL END: S/R INI_THETA'
122 ELSE
123 WRITE(msgBuf,'(A,I10,A)')
124 & '** WARNINGS ** INI_THETA: found', localWarnings,
125 & ' wet grid-pts with theta=0 identically.'
126 CALL PRINT_MESSAGE( msgBuf, errorMessageUnit,
127 & SQUEEZE_RIGHT, myThid )
128 ENDIF
129 ENDIF
130
131 C-- Check that there are no values of temperature below freezing point.
132 Tfreezing=-1.9 _d 0
133 IF ( allowFreezing ) THEN
134 DO bj = myByLo(myThid), myByHi(myThid)
135 DO bi = myBxLo(myThid), myBxHi(myThid)
136 DO k=1,Nr
137 DO j=1-Oly,sNy+Oly
138 DO i=1-Olx,sNx+Olx
139 IF (theta(i,j,k,bi,bj) .LT. Tfreezing) THEN
140 theta(i,j,k,bi,bj) = Tfreezing
141 ENDIF
142 ENDDO
143 ENDDO
144 ENDDO
145 ENDDO
146 ENDDO
147 ENDIF
148
149 IF (debugMode) THEN
150 CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature',
151 & Nr, 1, myThid )
152 ENDIF
153
154 RETURN
155 END

  ViewVC Help
Powered by ViewVC 1.1.22