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

Annotation of /MITgcm/verification/advect_xz/code/ini_theta.F

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


Revision 1.2 - (hide annotations) (download)
Fri Apr 15 22:10:13 2005 UTC (19 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint57t_post, checkpoint57m_post, checkpoint57v_post, checkpoint57s_post, checkpoint57j_post, checkpoint57h_pre, checkpoint57y_post, checkpoint57x_post, checkpoint57y_pre, checkpoint57o_post, checkpoint57r_post, checkpoint57k_post, checkpoint57i_post, checkpoint57h_post, checkpoint57h_done, checkpoint57w_post, checkpoint57p_post, checkpint57u_post, checkpoint57q_post, checkpoint57z_post, checkpoint57l_post
Changes since 1.1: +80 -56 lines
bring local version closer to model/src version

1 jmc 1.2 C $Header: /u/gcmpack/MITgcm/model/src/ini_theta.F,v 1.20 2003/11/13 21:54:11 jmc Exp $
2     C $Name: $
3 adcroft 1.1
4     #include "CPP_OPTIONS.h"
5    
6 jmc 1.2 CBOP
7     C !ROUTINE: INI_THETA
8     C !INTERFACE:
9 adcroft 1.1 SUBROUTINE INI_THETA( myThid )
10 jmc 1.2 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 adcroft 1.1 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 jmc 1.2 C !INPUT/OUTPUT PARAMETERS:
37 adcroft 1.1 C == Routine arguments ==
38     C myThid - Number of this instance of INI_THETA
39     INTEGER myThid
40    
41 jmc 1.2 C !LOCAL VARIABLES:
42 adcroft 1.1 C == Local variables ==
43     C bi,bj - Loop counters
44     C I,J,K
45 jmc 1.2 C rD - Radial displacement of point I,J
46 adcroft 1.1 INTEGER bi, bj
47     INTEGER I, J, K, localWarnings
48 jmc 1.2 _RL Tfreezing
49     _RL rD
50 adcroft 1.1 CHARACTER*(MAX_LEN_MBUF) msgBuf
51 jmc 1.2 CEOP
52 adcroft 1.1
53 jmc 1.2 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 adcroft 1.1 C-- Initialise temperature field to a circular patch.
63 jmc 1.2 DO J=1,sNy
64     DO I=1,sNx
65 adcroft 1.1 rD=sqrt( (XC(i,j,bi,bj)-40.E3)**2
66     & +(YC(i,j,bi,bj)-40.E3)**2
67     & +(RC(k)+50.E3)**2 )
68     theta(i,j,k,bi,bj)=exp(-0.5*( rD/20.E3 )**2 )
69     ENDDO
70     ENDDO
71     ENDDO
72     ENDDO
73 jmc 1.2 ENDDO
74    
75     IF ( hydrogThetaFile .NE. ' ' ) THEN
76 adcroft 1.1 _BEGIN_MASTER( myThid )
77     CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', theta, 0, myThid )
78     _END_MASTER(myThid)
79 jmc 1.2 _EXCH_XYZ_R8(theta,myThid)
80 adcroft 1.1 ENDIF
81 jmc 1.2
82     C-- Apply mask and test consistency
83 adcroft 1.1 localWarnings=0
84     DO bj = myByLo(myThid), myByHi(myThid)
85     DO bi = myBxLo(myThid), myBxHi(myThid)
86     DO K=1,Nr
87 jmc 1.2 DO J=1-Oly,sNy+Oly
88     DO I=1-Olx,sNx+Olx
89     IF (maskC(I,J,K,bi,bj).EQ.0.) theta(I,J,K,bi,bj) = 0.
90     ENDDO
91     ENDDO
92     IF ( tRef(k).NE.0. ) THEN
93     DO J=1,sNy
94     DO I=1,sNx
95     IF ( maskC(I,J,K,bi,bj).NE.0.
96     & .AND. theta(I,J,K,bi,bj).EQ.0. ) THEN
97     localWarnings=localWarnings+1
98 adcroft 1.1 ENDIF
99 jmc 1.2 ENDDO
100 adcroft 1.1 ENDDO
101 jmc 1.2 ENDIF
102 adcroft 1.1 ENDDO
103     ENDDO
104     ENDDO
105     IF (localWarnings.NE.0) THEN
106     WRITE(msgBuf,'(A,A)')
107     & 'S/R INI_THETA: theta = 0 identically. If this is intentional',
108     & 'you will need to edit ini_theta.F to avoid this safety check'
109     CALL PRINT_ERROR( msgBuf , myThid)
110     STOP 'ABNORMAL END: S/R INI_THETA'
111     ENDIF
112    
113 jmc 1.2 C-- Check that there are no values of temperature below freezing point.
114     Tfreezing=-1.9 _d 0
115     IF ( allowFreezing ) THEN
116     DO bj = myByLo(myThid), myByHi(myThid)
117     DO bi = myBxLo(myThid), myBxHi(myThid)
118     DO K=1,Nr
119     DO J=1-Oly,sNy+Oly
120     DO I=1-Olx,sNx+Olx
121     IF (theta(I,J,k,bi,bj) .LT. Tfreezing) THEN
122     theta(I,J,K,bi,bj) = Tfreezing
123     ENDIF
124     ENDDO
125     ENDDO
126     ENDDO
127     ENDDO
128     ENDDO
129     ENDIF
130    
131     _EXCH_XYZ_R8(theta,myThid)
132    
133     CALL PLOT_FIELD_XYZRL( theta, 'Initial Temperature' ,
134 adcroft 1.1 & Nr, 1, myThid )
135    
136     RETURN
137     END

  ViewVC Help
Powered by ViewVC 1.1.22