/[MITgcm]/MITgcm/verification/tutorial_global_oce_latlon/code/ptracers_forcing_surf.F
ViewVC logotype

Contents of /MITgcm/verification/tutorial_global_oce_latlon/code/ptracers_forcing_surf.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Sun Sep 5 22:32:48 2010 UTC (13 years, 8 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63h, checkpoint63i, checkpoint63j, checkpoint63k, checkpoint63d, checkpoint63e, checkpoint63f, checkpoint63g, checkpoint63a, checkpoint63b, checkpoint63c, checkpoint64, checkpoint65, checkpoint63, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65o, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint62k, checkpoint62o, checkpoint62n, checkpoint62m, checkpoint62l, checkpoint62s, checkpoint62r, checkpoint62q, checkpoint62p, checkpoint62w, checkpoint62v, checkpoint62u, checkpoint62t, checkpoint62z, checkpoint62y, checkpoint62x
Changes since 1.5: +51 -5 lines
update after changing standard version
 (option for ptracer to convert Salt Relax into additional EmP)

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

  ViewVC Help
Powered by ViewVC 1.1.22