1 |
C $Header: /u/gcmpack/MITgcm/model/src/update_etah.F,v 1.12 2011/05/20 16:29:49 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PACKAGES_CONFIG.h" |
5 |
#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 after mom-correction-step/integr_continuity |
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 |
|
29 |
C !INPUT/OUTPUT PARAMETERS: |
30 |
C == Routine arguments == |
31 |
C myTime :: Current time in simulation |
32 |
C myIter :: Current iteration number |
33 |
C myThid :: my Thread Id number |
34 |
_RL myTime |
35 |
INTEGER myIter |
36 |
INTEGER myThid |
37 |
|
38 |
C !LOCAL VARIABLES: |
39 |
#ifdef EXACT_CONSERV |
40 |
C Local variables in common block |
41 |
|
42 |
C Local variables |
43 |
C i,j,bi,bj :: Loop counters |
44 |
INTEGER i,j,bi,bj |
45 |
CEOP |
46 |
|
47 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
48 |
|
49 |
DO bj=myByLo(myThid),myByHi(myThid) |
50 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
51 |
|
52 |
C-- before updating etaH, save current etaH field in etaHnm1 |
53 |
DO j=1-Oly,sNy+Oly |
54 |
DO i=1-Olx,sNx+Olx |
55 |
etaHnm1(i,j,bi,bj) = etaH(i,j,bi,bj) |
56 |
ENDDO |
57 |
ENDDO |
58 |
|
59 |
C-- Update etaH at the end of the time step : |
60 |
C Incorporate the Explicit part of -Divergence(Barotropic_Flow) |
61 |
|
62 |
IF (implicDiv2Dflow.EQ. 1. _d 0) THEN |
63 |
DO j=1-Oly,sNy+Oly |
64 |
DO i=1-Olx,sNx+Olx |
65 |
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
66 |
ENDDO |
67 |
ENDDO |
68 |
|
69 |
ELSE |
70 |
DO j=1,sNy |
71 |
DO i=1,sNx |
72 |
etaH(i,j,bi,bj) = etaN(i,j,bi,bj) |
73 |
& + (1. - implicDiv2Dflow)*dEtaHdt(i,j,bi,bj) |
74 |
& *deltaTfreesurf |
75 |
ENDDO |
76 |
ENDDO |
77 |
ENDIF |
78 |
|
79 |
#ifdef ALLOW_OBCS |
80 |
C-- Apply OBC to etaH (NonLin-FreeSurf): needed since viscous terms |
81 |
C depend on hFacZ which is not only function of boundary hFac values. |
82 |
IF ( useOBCS.AND.nonlinFreeSurf.GT.0 ) |
83 |
& CALL OBCS_APPLY_ETA( bi, bj, etaH, myThid ) |
84 |
#endif /* ALLOW_OBCS */ |
85 |
|
86 |
C- end bi,bj loop. |
87 |
ENDDO |
88 |
ENDDO |
89 |
|
90 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
91 |
|
92 |
IF ( implicDiv2Dflow .NE. 1. _d 0 .OR. |
93 |
& ( useOBCS.AND.nonlinFreeSurf.GT.0 ) ) |
94 |
& CALL EXCH_XY_RL( etaH, myThid ) |
95 |
|
96 |
#endif /* EXACT_CONSERV */ |
97 |
|
98 |
RETURN |
99 |
END |