1 |
C $Header: /u/gcmpack/MITgcm/model/src/update_surf_dr.F,v 1.9 2011/01/14 23:23:54 gforget Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: UPDATE_SURF_DR |
8 |
C !INTERFACE: |
9 |
SUBROUTINE UPDATE_SURF_DR( useLatest, myTime, myIter, myThid ) |
10 |
|
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE UPDATE_SURF_DR |
14 |
C | o Update the surface-level thickness fraction (hFacC,W,S) |
15 |
C | according to the surface r-position = Non-Linear FrSurf |
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 "GRID.h" |
26 |
#include "SURFACE.h" |
27 |
|
28 |
C !INPUT/OUTPUT PARAMETERS: |
29 |
C == Routine arguments == |
30 |
C useLatest :: if true use hFac_surfC, else use hFac_surfNm1C |
31 |
C myTime :: Current time in simulation |
32 |
C myIter :: Current iteration number in simulation |
33 |
C myThid :: Thread number for this instance of the routine. |
34 |
LOGICAL useLatest |
35 |
_RL myTime |
36 |
INTEGER myIter |
37 |
INTEGER myThid |
38 |
|
39 |
C !LOCAL VARIABLES: |
40 |
#ifdef NONLIN_FRSURF |
41 |
C Local variables |
42 |
C i,j,bi,bj - loop counter |
43 |
INTEGER i,j,k,bi,bj |
44 |
INTEGER ks |
45 |
CEOP |
46 |
|
47 |
DO bj=myByLo(myThid), myByHi(myThid) |
48 |
DO bi=myBxLo(myThid), myBxHi(myThid) |
49 |
|
50 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
51 |
|
52 |
IF (useLatest.AND.(nonlinFreeSurf.GT.0)) then |
53 |
|
54 |
C-- Update the fractional thickness "hFacC" of the surface level kSurfC : |
55 |
DO j=1-Oly,sNy+Oly |
56 |
DO i=1-Olx,sNx+Olx |
57 |
ks = kSurfC(i,j,bi,bj) |
58 |
IF (ks.LE.Nr) THEN |
59 |
hFacC(i,j,ks,bi,bj) = hFac_surfC(i,j,bi,bj) |
60 |
recip_hFacC(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfC(i,j,bi,bj) |
61 |
ENDIF |
62 |
ENDDO |
63 |
ENDDO |
64 |
|
65 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
66 |
C-- Update fractional thickness "hFacW" & "hFacS" (at U and V points) |
67 |
|
68 |
DO j=1-Oly,sNy+Oly |
69 |
DO i=2-Olx,sNx+Olx |
70 |
ks = kSurfW(i,j,bi,bj) |
71 |
IF (ks.LE.Nr) THEN |
72 |
hFacW(i,j,ks,bi,bj) = hFac_surfW(i,j,bi,bj) |
73 |
recip_hFacW(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfW(i,j,bi,bj) |
74 |
ENDIF |
75 |
ENDDO |
76 |
ENDDO |
77 |
DO j=2-Oly,sNy+Oly |
78 |
DO i=1-Olx,sNx+Olx |
79 |
ks = kSurfS(i,j,bi,bj) |
80 |
IF (ks.LE.Nr) THEN |
81 |
hFacS(i,j,ks,bi,bj) = hFac_surfS(i,j,bi,bj) |
82 |
recip_hFacS(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfS(i,j,bi,bj) |
83 |
ENDIF |
84 |
ENDDO |
85 |
ENDDO |
86 |
|
87 |
ELSEIF (nonlinFreeSurf.GT.0) THEN |
88 |
|
89 |
C-- Update the fractional thickness "hFacC" of the surface level kSurfC |
90 |
C: |
91 |
DO j=1-Oly,sNy+Oly |
92 |
DO i=1-Olx,sNx+Olx |
93 |
ks = kSurfC(i,j,bi,bj) |
94 |
IF (ks.LE.Nr) THEN |
95 |
hFacC(i,j,ks,bi,bj) = hFac_surfNm1C(i,j,bi,bj) |
96 |
recip_hFacC(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfNm1C(i,j,bi,bj) |
97 |
ENDIF |
98 |
ENDDO |
99 |
ENDDO |
100 |
|
101 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
102 |
C-- Update fractional thickness "hFacW" & "hFacS" (at U and V points) |
103 |
|
104 |
DO j=1-Oly,sNy+Oly |
105 |
DO i=2-Olx,sNx+Olx |
106 |
ks = kSurfW(i,j,bi,bj) |
107 |
IF (ks.LE.Nr) THEN |
108 |
hFacW(i,j,ks,bi,bj) = hFac_surfNm1W(i,j,bi,bj) |
109 |
recip_hFacW(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfNm1W(i,j,bi,bj) |
110 |
ENDIF |
111 |
ENDDO |
112 |
ENDDO |
113 |
DO j=2-Oly,sNy+Oly |
114 |
DO i=1-Olx,sNx+Olx |
115 |
ks = kSurfS(i,j,bi,bj) |
116 |
IF (ks.LE.Nr) THEN |
117 |
hFacS(i,j,ks,bi,bj) = hFac_surfNm1S(i,j,bi,bj) |
118 |
recip_hFacS(i,j,ks,bi,bj)= 1. _d 0 / hFac_surfNm1S(i,j,bi,bj) |
119 |
ENDIF |
120 |
ENDDO |
121 |
ENDDO |
122 |
|
123 |
ELSE |
124 |
|
125 |
DO k=1,Nr |
126 |
DO j=1-Oly,sNy+Oly |
127 |
DO i=1-Olx,sNx+Olx |
128 |
hFacC(i,j,k,bi,bj)=h0FacC(i,j,k,bi,bj) |
129 |
IF (h0FacC(i,j,k,bi,bj) .NE. 0. ) THEN |
130 |
recip_hFacC(i,j,k,bi,bj) = 1. _d 0 / h0FacC(i,j,k,bi,bj) |
131 |
ELSE |
132 |
recip_hFacC(i,j,k,bi,bj) = 0. |
133 |
ENDIF |
134 |
ENDDO |
135 |
ENDDO |
136 |
ENDDO |
137 |
|
138 |
ENDIF |
139 |
|
140 |
C- end bi,bj loop |
141 |
ENDDO |
142 |
ENDDO |
143 |
|
144 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
145 |
#endif /* NONLIN_FRSURF */ |
146 |
|
147 |
RETURN |
148 |
END |