1 |
C $Header: /u/gcmpack/MITgcm/pkg/ptracers/ptracers_forcing_surf.F,v 1.9 2007/11/05 18:48:04 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PTRACERS_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: PTRACERS_FORCING_SURF |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE PTRACERS_FORCING_SURF( |
11 |
I relaxForcingS, |
12 |
I bi, bj, iMin, iMax, jMin, jMax, |
13 |
I myTime,myIter,myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C Precomputes surface forcing term for pkg/ptracers. |
17 |
C Precomputation is needed because of non-local KPP transport term, |
18 |
C routine KPP_TRANSPORT_PTR. |
19 |
|
20 |
C !USES: =============================================================== |
21 |
IMPLICIT NONE |
22 |
#include "SIZE.h" |
23 |
#include "EEPARAMS.h" |
24 |
#include "PARAMS.h" |
25 |
#include "GRID.h" |
26 |
#include "SURFACE.h" |
27 |
#include "DYNVARS.h" |
28 |
#include "FFIELDS.h" |
29 |
#include "PTRACERS_SIZE.h" |
30 |
#include "PTRACERS_PARAMS.h" |
31 |
#include "PTRACERS_FIELDS.h" |
32 |
|
33 |
C !INPUT PARAMETERS: =================================================== |
34 |
C relaxForcingS :: Salt forcing due to surface relaxation |
35 |
C bi,bj :: tile indices |
36 |
C myTime :: model time |
37 |
C myIter :: time-step number |
38 |
C myThid :: thread number |
39 |
_RL relaxForcingS(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
40 |
INTEGER bi, bj, iMin, iMax, jMin, jMax |
41 |
_RL myTime |
42 |
INTEGER myIter |
43 |
INTEGER myThid |
44 |
|
45 |
#ifdef ALLOW_PTRACERS |
46 |
|
47 |
C !LOCAL VARIABLES: ==================================================== |
48 |
C i,j :: loop indices |
49 |
C iTrc :: tracer index |
50 |
C ks :: surface level index |
51 |
INTEGER i, j |
52 |
INTEGER iTrc, ks |
53 |
_RL add2EmP(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
54 |
_RL epsil, cutoff, tmpVar |
55 |
CEOP |
56 |
|
57 |
IF ( usingPCoords ) THEN |
58 |
ks = Nr |
59 |
ELSE |
60 |
ks = 1 |
61 |
ENDIF |
62 |
|
63 |
C Example of how to add forcing at the surface |
64 |
DO iTrc=1,PTRACERS_numInUse |
65 |
DO j = jMin, jMax |
66 |
DO i = iMin, iMax |
67 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
68 |
& + 1. _d 0 / (10. _d 0 * 86400. _d 0) |
69 |
& * ( 0. _d 0 - pTracer(i,j,ks,bi,bj,iTrc) ) |
70 |
& * drF(ks) * _hFacC(i,j,ks,bi,bj) |
71 |
ENDDO |
72 |
ENDDO |
73 |
ENDDO |
74 |
|
75 |
C-- Option to convert Salt-relaxation into additional EmP contribution |
76 |
IF ( PTRACERS_addSrelax2EmP ) THEN |
77 |
C- here we assume that salt_EvPrRn = 0 |
78 |
C set cutoff value to prevent too large additional EmP: |
79 |
C current limit is set to 0.1 CFL |
80 |
epsil = 1. _d -10 |
81 |
cutoff = 0.1 _d 0 *drF(ks)/PTRACERS_dTLev(ks) |
82 |
IF ( ( (nonlinFreeSurf.GT.0 .OR. usingPCoords) |
83 |
& .AND. useRealFreshWaterFlux ) |
84 |
& .OR.convertFW2Salt .EQ. -1. ) THEN |
85 |
DO j = jMin, jMax |
86 |
DO i = iMin, iMax |
87 |
tmpVar = MAX( salt(i,j,ks,bi,bj), epsil ) |
88 |
add2EmP(i,j) = relaxForcingS(i,j)/tmpVar |
89 |
add2EmP(i,j) = rUnit2mass |
90 |
& *MAX( -cutoff, MIN( add2EmP(i,j), cutoff ) ) |
91 |
ENDDO |
92 |
ENDDO |
93 |
ELSE |
94 |
DO j = jMin, jMax |
95 |
DO i = iMin, iMax |
96 |
add2EmP(i,j) = relaxForcingS(i,j)/convertFW2Salt |
97 |
add2EmP(i,j) = rUnit2mass |
98 |
& *MAX( -cutoff, MIN( add2EmP(i,j), cutoff ) ) |
99 |
ENDDO |
100 |
ENDDO |
101 |
ENDIF |
102 |
#ifdef ALLOW_DIAGNOSTICS |
103 |
IF ( useDiagnostics ) THEN |
104 |
CALL DIAGNOSTICS_FILL(add2EmP,'Add2EmP ',0,1,2,bi,bj,myThid) |
105 |
ENDIF |
106 |
#endif /* ALLOW_DIAGNOSTICS */ |
107 |
ELSE |
108 |
DO j = jMin, jMax |
109 |
DO i = iMin, iMax |
110 |
add2EmP(i,j) = 0. _d 0 |
111 |
ENDDO |
112 |
ENDDO |
113 |
ENDIF |
114 |
C-- end of "addEmP" setting |
115 |
|
116 |
#ifdef EXACT_CONSERV |
117 |
IF ( (nonlinFreeSurf.GT.0 .OR. usingPCoords) |
118 |
& .AND. useRealFreshWaterFlux ) THEN |
119 |
|
120 |
DO iTrc=1,PTRACERS_numInUse |
121 |
|
122 |
c- NonLin_FrSurf and RealFreshWaterFlux : PmEpR effectively changes |
123 |
c the water column height ; temp., salt, (tracer) flux associated |
124 |
c with this input/output of water is added here to the surface tendency. |
125 |
c |
126 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
127 |
DO j = jMin, jMax |
128 |
DO i = iMin, iMax |
129 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
130 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
131 |
& + ( PmEpR(i,j,bi,bj) - add2EmP(i,j) ) |
132 |
& *( PTRACERS_EvPrRn(iTrc) - pTracer(i,j,ks,bi,bj,iTrc) ) |
133 |
& *mass2rUnit |
134 |
ENDDO |
135 |
ENDDO |
136 |
ENDIF |
137 |
|
138 |
ENDDO |
139 |
|
140 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
141 |
ELSE |
142 |
#else /* EXACT_CONSERV */ |
143 |
IF (.TRUE.) THEN |
144 |
#endif /* EXACT_CONSERV */ |
145 |
|
146 |
C-- EmPmR does not really affect the water column height (for tracer budget) |
147 |
C and is converted to a salt tendency. |
148 |
|
149 |
IF (convertFW2Salt .EQ. -1.) THEN |
150 |
C- use local surface tracer field to calculate forcing term: |
151 |
|
152 |
DO iTrc=1,PTRACERS_numInUse |
153 |
|
154 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
155 |
C account for Rain/Evap tracer content (PTRACERS_EvPrRn) using |
156 |
C local surface tracer |
157 |
DO j = jMin, jMax |
158 |
DO i = iMin, iMax |
159 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
160 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
161 |
& + ( EmPmR(i,j,bi,bj) + add2EmP(i,j) ) |
162 |
& *( pTracer(i,j,ks,bi,bj,iTrc) - PTRACERS_EvPrRn(iTrc) ) |
163 |
& *mass2rUnit |
164 |
ENDDO |
165 |
ENDDO |
166 |
ENDIF |
167 |
|
168 |
ENDDO |
169 |
|
170 |
ELSE |
171 |
C- use uniform tracer value to calculate forcing term: |
172 |
|
173 |
DO iTrc=1,PTRACERS_numInUse |
174 |
|
175 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
176 |
C account for Rain/Evap tracer content (PTRACERS_EvPrRn) assuming uniform |
177 |
C surface tracer (=PTRACERS_ref) |
178 |
DO j = jMin, jMax |
179 |
DO i = iMin, iMax |
180 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
181 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
182 |
& + ( EmPmR(i,j,bi,bj) + add2EmP(i,j) ) |
183 |
& *( PTRACERS_ref(ks,iTrc) - PTRACERS_EvPrRn(iTrc) ) |
184 |
& *mass2rUnit |
185 |
ENDDO |
186 |
ENDDO |
187 |
ENDIF |
188 |
|
189 |
ENDDO |
190 |
|
191 |
C- end local-surface-tracer / uniform-value distinction |
192 |
ENDIF |
193 |
|
194 |
ENDIF |
195 |
|
196 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
197 |
|
198 |
#endif /* ALLOW_PTRACERS */ |
199 |
|
200 |
RETURN |
201 |
END |