1 |
C $Header: /u/gcmpack/MITgcm/model/src/calc_wsurf_tr.F,v 1.1 2007/01/05 01:35:00 dfer Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: CALC_WSURF_TR |
8 |
C !INTERFACE: |
9 |
SUBROUTINE CALC_WSURF_TR(thetaFld, saltFld, wVelFld, |
10 |
I myTime, myIter, myThid ) |
11 |
C !DESCRIPTION: \bv |
12 |
C *==========================================================* |
13 |
C | SUBROUTINE CALC_WSURF_TR |
14 |
C | o Compute a correction for the source/sink of tracer |
15 |
C | due to the linear free surface. |
16 |
C | o The source/sink results from W*Tr not summing to |
17 |
C | zero at the free surface. |
18 |
C | o Here, we compute an area-weighted mean correction |
19 |
C | to be applied in external_forcing.F |
20 |
C *==========================================================* |
21 |
C \ev |
22 |
|
23 |
C !USES: |
24 |
IMPLICIT NONE |
25 |
C == Global variables |
26 |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
29 |
#include "GRID.h" |
30 |
#include "SURFACE.h" |
31 |
|
32 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
C == Routine arguments == |
34 |
C myTime :: Current time in simulation |
35 |
C myIter :: Current iteration number in simulation |
36 |
C myThid :: Thread number for this instance of the routine. |
37 |
C thetaFld :: Potential Temperature field |
38 |
C saltFld :: Salinity field |
39 |
C wvelFld :: vertical velocity field |
40 |
_RL myTime |
41 |
INTEGER myIter |
42 |
INTEGER myThid |
43 |
_RL thetaFld(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
44 |
_RL saltFld (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
45 |
_RL wVelFld (1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
46 |
|
47 |
C !LOCAL VARIABLES: |
48 |
C Local variables |
49 |
C i,j,k,bi,bj :: loop counter |
50 |
INTEGER i,j,bi,bj,ks |
51 |
_RL wT_Mean, wS_Mean |
52 |
_RL wT_Tile(nSx,nSy) |
53 |
_RL wS_Tile(nSx,nSy) |
54 |
CEOP |
55 |
|
56 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
57 |
|
58 |
TsurfCor= 0. |
59 |
SsurfCor= 0. |
60 |
|
61 |
wT_Mean = 0. |
62 |
wS_Mean = 0. |
63 |
|
64 |
DO bj=myByLo(myThid), myByHi(myThid) |
65 |
DO bi=myBxLo(myThid), myBxHi(myThid) |
66 |
wT_Tile(bi,bj) = 0. |
67 |
wS_Tile(bi,bj) = 0. |
68 |
DO j=1,sNy |
69 |
DO i=1,sNx |
70 |
ks = ksurfC(i,j,bi,bj) |
71 |
IF (ks.LE.Nr) THEN |
72 |
wT_Tile(bi,bj) = wT_Tile(bi,bj) |
73 |
& + rA(i,j,bi,bj)*wVelFld(i,j,ks,bi,bj) |
74 |
& *thetaFld(i,j,ks,bi,bj) |
75 |
wS_Tile(bi,bj) = wS_Tile(bi,bj) |
76 |
& + rA(i,j,bi,bj)*wVelFld(i,j,ks,bi,bj) |
77 |
& *saltFld(i,j,ks,bi,bj) |
78 |
ENDIF |
79 |
ENDDO |
80 |
ENDDO |
81 |
c#ifdef ALLOW_AUTODIFF_TAMC |
82 |
c wT_Mean = wT_Mean + wT_Tile(bi,bj) |
83 |
c wS_Mean = wS_Mean + wS_Tile(bi,bj) |
84 |
c#endif |
85 |
C- end bi,bj loop. |
86 |
ENDDO |
87 |
ENDDO |
88 |
|
89 |
C-- Global diagnostic : |
90 |
c#ifdef ALLOW_AUTODIFF_TAMC |
91 |
c _GLOBAL_SUM_RL(wT_Mean,myThid) |
92 |
c _GLOBAL_SUM_RL(wS_Mean,myThid) |
93 |
c#else |
94 |
CALL GLOBAL_SUM_TILE_RL( wT_Tile, wT_Mean, myThid ) |
95 |
CALL GLOBAL_SUM_TILE_RL( wS_Tile, wS_Mean, myThid ) |
96 |
c#endif |
97 |
|
98 |
IF ( globalArea.GT.0. ) THEN |
99 |
_BEGIN_MASTER( myThid ) |
100 |
TsurfCor = wT_Mean / globalArea |
101 |
SsurfCor = wS_Mean / globalArea |
102 |
_END_MASTER( myThid ) |
103 |
ENDIF |
104 |
_BARRIER |
105 |
|
106 |
C----- |
107 |
|
108 |
RETURN |
109 |
END |