1 |
cnh |
1.6.2.2 |
C $Header: /u/gcmpack/models/MITgcmUV/model/src/ini_theta.F,v 1.6.2.1 1998/06/19 04:55:13 cnh Exp $ |
2 |
cnh |
1.1 |
|
3 |
|
|
#include "CPP_EEOPTIONS.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 |
|
|
|
22 |
|
|
C === Global variables === |
23 |
|
|
#include "SIZE.h" |
24 |
|
|
#include "EEPARAMS.h" |
25 |
|
|
#include "PARAMS.h" |
26 |
|
|
#include "GRID.h" |
27 |
|
|
#include "DYNVARS.h" |
28 |
|
|
|
29 |
|
|
C == Routine arguments == |
30 |
|
|
C myThid - Number of this instance of INI_THETA |
31 |
|
|
INTEGER myThid |
32 |
|
|
CEndOfInterface |
33 |
|
|
|
34 |
|
|
C == Local variables == |
35 |
|
|
C iC, jC - Center of domain |
36 |
|
|
C iD, jD - Disitance from domain center. |
37 |
|
|
C rad - Radius of initial patch |
38 |
|
|
C rD - Radial displacement of point I,J |
39 |
|
|
C iG, jG - Global coordinate index |
40 |
|
|
C bi,bj - Loop counters |
41 |
|
|
C I,J,K |
42 |
|
|
INTEGER iC, jC, iD, jD |
43 |
|
|
INTEGER iG, jG |
44 |
|
|
INTEGER bi, bj |
45 |
|
|
INTEGER I, J, K |
46 |
|
|
REAL rad, rD |
47 |
|
|
|
48 |
cnh |
1.3 |
_BARRIER |
49 |
|
|
|
50 |
|
|
IF ( hydrogThetaFile .EQ. ' ' ) THEN |
51 |
|
|
C-- Example 1 |
52 |
|
|
C-- Initialise temperature field to a circular patch. |
53 |
|
|
iC = Nx/2 |
54 |
|
|
jC = Ny/2 |
55 |
|
|
rad = MIN(Ny/8,Nx/8) |
56 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
57 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
58 |
|
|
DO K=1,Nz |
59 |
|
|
DO J=1,sNy |
60 |
|
|
DO I=1,sNx |
61 |
|
|
theta(I,J,K,bi,bj) = 0. _d 0 |
62 |
|
|
iG = myXGlobalLo-1+(bi-1)*sNx+I |
63 |
|
|
jG = myYGlobalLo-1+(bj-1)*sNy+J |
64 |
|
|
iD = iG-iC |
65 |
|
|
jD = jG-jC |
66 |
|
|
rD = SQRT(FLOAT(iD*iD+jD*jD)) |
67 |
|
|
IF ( rD .LT. rad ) theta(I,J,K,bi,bj) = 1. _d 0 |
68 |
|
|
ENDDO |
69 |
cnh |
1.1 |
ENDDO |
70 |
|
|
ENDDO |
71 |
|
|
ENDDO |
72 |
|
|
ENDDO |
73 |
cnh |
1.3 |
C-- Example 2 |
74 |
|
|
C-- Initialise temperature field to the vertical reference profile |
75 |
|
|
DO bj = myByLo(myThid), myByHi(myThid) |
76 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
77 |
|
|
DO K=1,Nz |
78 |
|
|
DO J=1,sNy |
79 |
|
|
DO I=1,sNx |
80 |
|
|
theta(I,J,K,bi,bj) = tRef(K) |
81 |
|
|
ENDDO |
82 |
cnh |
1.1 |
ENDDO |
83 |
|
|
ENDDO |
84 |
|
|
ENDDO |
85 |
|
|
ENDDO |
86 |
cnh |
1.3 |
ELSE |
87 |
|
|
_BEGIN_MASTER( myThid ) |
88 |
cnh |
1.4 |
CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid ) |
89 |
cnh |
1.3 |
_END_MASTER(myThid) |
90 |
|
|
ENDIF |
91 |
cnh |
1.1 |
C Set initial tendency terms |
92 |
cnh |
1.6.2.1 |
C Note: gTNm1 is set to initial theta to make it consistent with |
93 |
|
|
C the theta* scheme used. |
94 |
cnh |
1.1 |
DO bj = myByLo(myThid), myByHi(myThid) |
95 |
|
|
DO bi = myBxLo(myThid), myBxHi(myThid) |
96 |
|
|
DO K=1,Nz |
97 |
|
|
DO J=1,sNy |
98 |
|
|
DO I=1,sNx |
99 |
|
|
gt (I,J,K,bi,bj) = 0. _d 0 |
100 |
cnh |
1.6.2.2 |
gtNM1(I,J,K,bi,bj) = 0. _d 0 |
101 |
cnh |
1.1 |
ENDDO |
102 |
|
|
ENDDO |
103 |
|
|
ENDDO |
104 |
|
|
ENDDO |
105 |
|
|
ENDDO |
106 |
|
|
C |
107 |
|
|
_EXCH_XYZ_R8(theta , myThid ) |
108 |
|
|
_EXCH_XYZ_R8(gt , myThid ) |
109 |
|
|
_EXCH_XYZ_R8(gtNM1 , myThid ) |
110 |
cnh |
1.5 |
|
111 |
cnh |
1.6 |
CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' , Nz, 1, myThid ) |
112 |
cnh |
1.5 |
|
113 |
cnh |
1.1 |
RETURN |
114 |
|
|
END |