1 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_theta.F,v 1.12 1999/07/30 15:42:59 adcroft Exp $ |
2 |
|
3 |
#include "CPP_OPTIONS.h" |
4 |
|
5 |
CStartOfInterface |
6 |
SUBROUTINE INI_THETA( myThid ) |
7 |
C /==========================================================\ |
8 |
C | SUBROUTINE INI_THETA | |
9 |
C | o Set model initial temperature field. | |
10 |
C |==========================================================| |
11 |
C | There are several options for setting the initial | |
12 |
C | temperature file | |
13 |
C | 1. Inline code | |
14 |
C | 2. Vertical profile ( uniform T in X and Y ) | |
15 |
C | 3. Three-dimensional data from a file. For example from | |
16 |
C | Levitus or from a checkpoint file from a previous | |
17 |
C | integration. | |
18 |
C | In addition to setting the temperature field we also | |
19 |
C | set the initial temperature tendency term here. | |
20 |
C \==========================================================/ |
21 |
IMPLICIT NONE |
22 |
|
23 |
C === Global variables === |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
#include "GRID.h" |
28 |
#include "DYNVARS.h" |
29 |
|
30 |
C == Routine arguments == |
31 |
C myThid - Number of this instance of INI_THETA |
32 |
INTEGER myThid |
33 |
CEndOfInterface |
34 |
|
35 |
C == Local variables == |
36 |
C iC, jC - Center of domain |
37 |
C iD, jD - Disitance from domain center. |
38 |
C rad - Radius of initial patch |
39 |
C rD - Radial displacement of point I,J |
40 |
C iG, jG - Global coordinate index |
41 |
C bi,bj - Loop counters |
42 |
C I,J,K |
43 |
INTEGER iC, jC, iD, jD |
44 |
INTEGER iG, jG |
45 |
INTEGER bi, bj |
46 |
INTEGER I, J, K, localWarnings |
47 |
_RL rad, rD |
48 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
49 |
|
50 |
_BARRIER |
51 |
|
52 |
IF ( hydrogThetaFile .EQ. ' ' ) THEN |
53 |
C-- Example 1 |
54 |
C-- Initialise temperature field to a circular patch. |
55 |
iC = Nx/2 |
56 |
jC = Ny/2 |
57 |
rad = MIN(Ny/8,Nx/8) |
58 |
DO bj = myByLo(myThid), myByHi(myThid) |
59 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
60 |
DO K=1,Nr |
61 |
DO J=1,sNy |
62 |
DO I=1,sNx |
63 |
theta(I,J,K,bi,bj) = 0. _d 0 |
64 |
iG = myXGlobalLo-1+(bi-1)*sNx+I |
65 |
jG = myYGlobalLo-1+(bj-1)*sNy+J |
66 |
iD = iG-iC |
67 |
jD = jG-jC |
68 |
rD = SQRT(FLOAT(iD*iD+jD*jD)) |
69 |
IF ( rD .LT. rad ) theta(I,J,K,bi,bj) = 1. _d 0 |
70 |
ENDDO |
71 |
ENDDO |
72 |
ENDDO |
73 |
ENDDO |
74 |
ENDDO |
75 |
C-- Example 2 |
76 |
C-- Initialise temperature field to the vertical reference profile |
77 |
DO bj = myByLo(myThid), myByHi(myThid) |
78 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
79 |
DO K=1,Nr |
80 |
DO J=1,sNy |
81 |
DO I=1,sNx |
82 |
theta(I,J,K,bi,bj) = tRef(K) |
83 |
ENDDO |
84 |
ENDDO |
85 |
ENDDO |
86 |
ENDDO |
87 |
ENDDO |
88 |
ELSE |
89 |
_BEGIN_MASTER( myThid ) |
90 |
CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid ) |
91 |
_END_MASTER(myThid) |
92 |
ENDIF |
93 |
C Set initial tendency terms |
94 |
localWarnings=0 |
95 |
DO bj = myByLo(myThid), myByHi(myThid) |
96 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
97 |
DO K=1,Nr |
98 |
DO J=1,sNy |
99 |
DO I=1,sNx |
100 |
gt (I,J,K,bi,bj) = 0. _d 0 |
101 |
gtNM1(I,J,K,bi,bj) = 0. _d 0 |
102 |
IF (hFacC(I,J,K,bi,bj).EQ.0) theta(I,J,K,bi,bj) = 0. |
103 |
IF (hFacC(I,J,K,bi,bj).NE.0.AND.theta(I,J,K,bi,bj).EQ.0.) |
104 |
& THEN |
105 |
localWarnings=localWarnings+1 |
106 |
ENDIF |
107 |
ENDDO |
108 |
ENDDO |
109 |
ENDDO |
110 |
ENDDO |
111 |
ENDDO |
112 |
IF (localWarnings.NE.0) THEN |
113 |
WRITE(msgBuf,'(A,A)') |
114 |
& 'S/R INI_THETA: theta = 0 identically. If this is intentional', |
115 |
& 'you will need to edit ini_theta.F to avoid this safety check' |
116 |
CALL PRINT_ERROR( msgBuf , myThid) |
117 |
STOP 'ABNORMAL END: S/R INI_THETA' |
118 |
ENDIF |
119 |
C |
120 |
_EXCH_XYZ_R8(theta , myThid ) |
121 |
_EXCH_XYZ_R8(gt , myThid ) |
122 |
_EXCH_XYZ_R8(gtNM1 , myThid ) |
123 |
|
124 |
CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' , |
125 |
& Nr, 1, myThid ) |
126 |
|
127 |
RETURN |
128 |
END |