1 |
edhill |
1.3 |
C $Header: /u/u3/gcmpack/MITgcm/model/src/update_etah.F,v 1.2.6.1 2003/10/02 18:10:45 edhill Exp $ |
2 |
jmc |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
edhill |
1.3 |
#include "PACKAGES_CONFIG.h" |
5 |
jmc |
1.1 |
#include "CPP_OPTIONS.h" |
6 |
|
|
|
7 |
|
|
CBOP |
8 |
|
|
C !ROUTINE: UPDATE_ETAH |
9 |
|
|
C !INTERFACE: |
10 |
|
|
SUBROUTINE UPDATE_ETAH( myTime, myIter, myThid ) |
11 |
|
|
C !DESCRIPTION: \bv |
12 |
|
|
C *==========================================================* |
13 |
|
|
C | SUBROUTINE UPDATE_ETAH |
14 |
|
|
C | o Update etaH at the begining of the time step. |
15 |
|
|
C | (required with NLFS to derive surface layer thickness) |
16 |
|
|
C *==========================================================* |
17 |
|
|
C \ev |
18 |
|
|
|
19 |
|
|
C !USES: |
20 |
|
|
IMPLICIT NONE |
21 |
|
|
C == Global variables |
22 |
|
|
#include "SIZE.h" |
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "PARAMS.h" |
25 |
|
|
#include "DYNVARS.h" |
26 |
|
|
#include "GRID.h" |
27 |
|
|
#include "SURFACE.h" |
28 |
|
|
#include "FFIELDS.h" |
29 |
|
|
|
30 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
31 |
|
|
C == Routine arguments == |
32 |
|
|
C myTime :: Current time in simulation |
33 |
|
|
C myIter :: Current iteration number in simulation |
34 |
|
|
C myThid :: Thread number for this instance of the routine. |
35 |
|
|
_RL myTime |
36 |
|
|
INTEGER myIter |
37 |
|
|
INTEGER myThid |
38 |
|
|
|
39 |
|
|
C !LOCAL VARIABLES: |
40 |
|
|
#ifdef EXACT_CONSERV |
41 |
|
|
C Local variables in common block |
42 |
|
|
|
43 |
|
|
C Local variables |
44 |
|
|
C i,j,k,bi,bj :: Loop counters |
45 |
|
|
INTEGER i,j,k,bi,bj |
46 |
|
|
CEOP |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
50 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
51 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
52 |
|
|
|
53 |
|
|
#ifdef NONLIN_FRSURF |
54 |
jmc |
1.2 |
c IF (useRealFreshWaterFlux .AND. nonlinFreeSurf.GT.0) THEN |
55 |
|
|
IF ( (nonlinFreeSurf.GT.0 .OR. buoyancyRelation.EQ.'OCEANICP') |
56 |
|
|
& .AND. useRealFreshWaterFlux ) THEN |
57 |
jmc |
1.1 |
|
58 |
|
|
C-- Called at the beginning of the time step : |
59 |
|
|
C- keep present time EmPmR to compute later (S/R EXTERNAL_FORCING_SURF) |
60 |
|
|
C tracers and momentum flux associated with fresh water input. |
61 |
|
|
|
62 |
|
|
IF ( myTime.NE.startTime ) THEN |
63 |
|
|
DO j=1-Oly,sNy+Oly |
64 |
|
|
DO i=1-Olx,sNx+Olx |
65 |
|
|
PmEpR(i,j,bi,bj) = -EmPmR(i,j,bi,bj) |
66 |
|
|
ENDDO |
67 |
|
|
ENDDO |
68 |
|
|
|
69 |
jmc |
1.2 |
ELSE |
70 |
jmc |
1.1 |
DO j=1-Oly,sNy+Oly |
71 |
|
|
DO i=1-Olx,sNx+Olx |
72 |
|
|
PmEpR(i,j,bi,bj) = 0. _d 0 |
73 |
|
|
ENDDO |
74 |
|
|
ENDDO |
75 |
|
|
|
76 |
jmc |
1.2 |
IF( myTime .NE. 0. _d 0 .AND. nonlinFreeSurf.GE.0 ) THEN |
77 |
jmc |
1.1 |
C needs previous time-step value of E-P-R, that has not been loaded |
78 |
|
|
C and was not in pickup-file ; try to use etaN & etaH instead. |
79 |
|
|
DO j=1,sNy |
80 |
|
|
DO i=1,sNx |
81 |
|
|
PmEpR(i,j,bi,bj) = |
82 |
|
|
& hDivFlow(i,j,bi,bj)*recip_rA(i,j,bi,bj) |
83 |
|
|
& + (etaN(i,j,bi,bj)-etaH(i,j,bi,bj)) |
84 |
|
|
& /(implicDiv2Dflow*deltaTfreesurf) |
85 |
jmc |
1.2 |
PmEpR(i,j,bi,bj) = PmEpR(i,j,bi,bj)/convertEmP2rUnit |
86 |
jmc |
1.1 |
ENDDO |
87 |
|
|
ENDDO |
88 |
jmc |
1.2 |
ENDIF |
89 |
jmc |
1.1 |
ENDIF |
90 |
|
|
|
91 |
|
|
ENDIF |
92 |
|
|
#endif /* NONLIN_FRSURF */ |
93 |
|
|
|
94 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
95 |
|
|
|
96 |
|
|
C-- Update etaH at the beginning of the time step : |
97 |
|
|
C Incorporate the Explicit part of -Divergence(Barotropic_Flow) |
98 |
|
|
|
99 |
|
|
IF ( useRealFreshWaterFlux .AND. myTime.EQ.startTime ) THEN |
100 |
|
|
C needs previous time-step value of E-P-R, that has not been loaded |
101 |
|
|
C and was not in pickup-file ; try to use etaN & etaH instead. |
102 |
|
|
DO j=1-Oly,sNy+Oly |
103 |
|
|
DO i=1-Olx,sNx+Olx |
104 |
|
|
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
105 |
|
|
& + (etaN(i,j,bi,bj)-etaH(i,j,bi,bj)) |
106 |
|
|
& *(1. - implicDiv2Dflow)/implicDiv2Dflow |
107 |
|
|
ENDDO |
108 |
|
|
ENDDO |
109 |
|
|
|
110 |
|
|
ELSEIF (implicDiv2Dflow.EQ. 1. _d 0) THEN |
111 |
|
|
DO j=1-Oly,sNy+Oly |
112 |
|
|
DO i=1-Olx,sNx+Olx |
113 |
|
|
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
114 |
|
|
ENDDO |
115 |
|
|
ENDDO |
116 |
|
|
|
117 |
|
|
ELSEIF (useRealFreshWaterFlux) THEN |
118 |
|
|
DO j=1,sNy |
119 |
|
|
DO i=1,sNx |
120 |
|
|
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
121 |
|
|
& - (1. - implicDiv2Dflow)*( convertEmP2rUnit*EmPmR(i,j,bi,bj) |
122 |
|
|
& +hDivFlow(i,j,bi,bj)*recip_rA(i,j,bi,bj) |
123 |
|
|
& )*deltaTfreesurf |
124 |
|
|
ENDDO |
125 |
|
|
ENDDO |
126 |
|
|
|
127 |
|
|
ELSE |
128 |
|
|
DO j=1,sNy |
129 |
|
|
DO i=1,sNx |
130 |
|
|
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
131 |
|
|
& - (1. - implicDiv2Dflow)*hDivFlow(i,j,bi,bj) |
132 |
|
|
& *recip_rA(i,j,bi,bj)*deltaTfreesurf |
133 |
|
|
ENDDO |
134 |
|
|
ENDDO |
135 |
|
|
ENDIF |
136 |
|
|
|
137 |
|
|
#ifdef ALLOW_OBCS |
138 |
|
|
#ifdef NONLIN_FRSURF |
139 |
|
|
C- note: 1) needs to apply OBC to etaH since viscous terms depend on hFacZ. |
140 |
|
|
C that is not only function of boundaries hFac values. |
141 |
|
|
C 2) has to be done before calc_surf_dr; but since obcs_calc is |
142 |
|
|
C called later, hFacZ will lag 1 time step behind OBC update. |
143 |
|
|
C 3) avoid also unrealistic value of etaH in OB regions that |
144 |
|
|
C might produce many "WARNING" message from calc_surf_dr. |
145 |
|
|
C------- |
146 |
|
|
IF ( useOBCS .AND. nonlinFreeSurf.GT.0 ) |
147 |
|
|
& CALL OBCS_APPLY_ETA( bi, bj, etaH, myThid ) |
148 |
|
|
#endif /* NONLIN_FRSURF */ |
149 |
|
|
#endif /* ALLOW_OBCS */ |
150 |
|
|
|
151 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
152 |
|
|
|
153 |
|
|
C- end bi,bj loop. |
154 |
|
|
ENDDO |
155 |
|
|
ENDDO |
156 |
|
|
|
157 |
|
|
IF (implicDiv2Dflow .NE. 1. _d 0 .OR. useOBCS ) |
158 |
jmc |
1.2 |
& _EXCH_XY_RL(etaH, myThid ) |
159 |
jmc |
1.1 |
|
160 |
|
|
#endif /* EXACT_CONSERV */ |
161 |
jmc |
1.2 |
|
162 |
|
|
#ifdef NONLIN_FRSURF |
163 |
|
|
IF ( buoyancyRelation.EQ.'OCEANICP' |
164 |
|
|
& .AND. useRealFreshWaterFlux |
165 |
|
|
& .AND. myTime.EQ.startTime ) THEN |
166 |
|
|
_EXCH_XY_RS(PmEpR, myThid ) |
167 |
|
|
ENDIF |
168 |
|
|
#endif /* NONLIN_FRSURF */ |
169 |
jmc |
1.1 |
|
170 |
|
|
RETURN |
171 |
|
|
END |