1 |
C $Header$ |
2 |
C $Name$ |
3 |
|
4 |
#include "LONGSTEP_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: LONGSTEP_FORCING_SURF |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE LONGSTEP_FORCING_SURF( |
11 |
I bi, bj, iMin, iMax, jMin, jMax, |
12 |
I myTime,myIter,myThid ) |
13 |
|
14 |
C !DESCRIPTION: |
15 |
C Precomputes surface forcing term for pkg/ptracers. |
16 |
C Precomputation is needed because of non-local KPP transport term, |
17 |
C routine KPP_TRANSPORT_PTR. |
18 |
|
19 |
C !USES: =============================================================== |
20 |
IMPLICIT NONE |
21 |
#include "SIZE.h" |
22 |
#include "EEPARAMS.h" |
23 |
#include "PARAMS.h" |
24 |
#include "GRID.h" |
25 |
#include "SURFACE.h" |
26 |
#include "FFIELDS.h" |
27 |
c #include "DYNVARS.h" |
28 |
#include "PTRACERS_SIZE.h" |
29 |
#include "PTRACERS_PARAMS.h" |
30 |
#include "PTRACERS_FIELDS.h" |
31 |
#include "LONGSTEP.h" |
32 |
|
33 |
C !INPUT PARAMETERS: =================================================== |
34 |
C bi,bj :: tile indices |
35 |
C myTime :: model time |
36 |
C myIter :: time-step number |
37 |
C myThid :: thread number |
38 |
INTEGER bi, bj, iMin, iMax, jMin, jMax |
39 |
_RL myTime |
40 |
INTEGER myIter |
41 |
INTEGER myThid |
42 |
|
43 |
#ifdef ALLOW_LONGSTEP |
44 |
|
45 |
C !LOCAL VARIABLES: ==================================================== |
46 |
C i,j :: loop indices |
47 |
C iTrc :: tracer index |
48 |
C ks :: surface level index |
49 |
INTEGER i, j |
50 |
INTEGER iTrc, ks |
51 |
CEOP |
52 |
|
53 |
IF ( usingPCoords ) THEN |
54 |
ks = Nr |
55 |
ELSE |
56 |
ks = 1 |
57 |
ENDIF |
58 |
|
59 |
C Example of how to add forcing at the surface |
60 |
DO iTrc=1,PTRACERS_numInUse |
61 |
DO j = jMin, jMax |
62 |
DO i = iMin, iMax |
63 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
64 |
& 0. _d 0 |
65 |
c & surfaceForcingS(i,j,bi,bj) |
66 |
ENDDO |
67 |
ENDDO |
68 |
ENDDO |
69 |
|
70 |
#ifdef EXACT_CONSERV |
71 |
IF ( (nonlinFreeSurf.GT.0 .OR. usingPCoords) |
72 |
& .AND. useRealFreshWaterFlux ) THEN |
73 |
|
74 |
DO iTrc=1,PTRACERS_numInUse |
75 |
|
76 |
c- NonLin_FrSurf and RealFreshWaterFlux : PmEpR effectively changes |
77 |
c the water column height ; temp., salt, (tracer) flux associated |
78 |
c with this input/output of water is added here to the surface tendency. |
79 |
c |
80 |
c NB: LS_fwflux is PmEpR |
81 |
c |
82 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
83 |
DO j = jMin, jMax |
84 |
DO i = iMin, iMax |
85 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
86 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
87 |
& + LS_fwFlux(i,j,bi,bj) |
88 |
& *( PTRACERS_EvPrRn(iTrc) - pTracer(i,j,ks,bi,bj,iTrc) ) |
89 |
& *mass2rUnit |
90 |
ENDDO |
91 |
ENDDO |
92 |
ENDIF |
93 |
|
94 |
ENDDO |
95 |
|
96 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
97 |
ELSE |
98 |
#else /* EXACT_CONSERV */ |
99 |
IF (.TRUE.) THEN |
100 |
#endif /* EXACT_CONSERV */ |
101 |
|
102 |
C-- EmPmR does not really affect the water column height (for tracer budget) |
103 |
C and is converted to a salt tendency. |
104 |
|
105 |
IF (convertFW2Salt .EQ. -1.) THEN |
106 |
C- use local surface tracer field to calculate forcing term: |
107 |
|
108 |
DO iTrc=1,PTRACERS_numInUse |
109 |
|
110 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
111 |
C account for Rain/Evap tracer content (PTRACERS_EvPrRn) using |
112 |
C local surface tracer |
113 |
c |
114 |
c NB: LS_fwflux is EmPmR |
115 |
|
116 |
DO j = jMin, jMax |
117 |
DO i = iMin, iMax |
118 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
119 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
120 |
& + LS_fwFlux(i,j,bi,bj) |
121 |
& *( pTracer(i,j,ks,bi,bj,iTrc) - PTRACERS_EvPrRn(iTrc) ) |
122 |
& *mass2rUnit |
123 |
ENDDO |
124 |
ENDDO |
125 |
ENDIF |
126 |
|
127 |
ENDDO |
128 |
|
129 |
ELSE |
130 |
C- use uniform tracer value to calculate forcing term: |
131 |
|
132 |
DO iTrc=1,PTRACERS_numInUse |
133 |
|
134 |
IF (PTRACERS_EvPrRn(iTrc).NE.UNSET_RL) THEN |
135 |
C account for Rain/Evap tracer content (PTRACERS_EvPrRn) assuming uniform |
136 |
C surface tracer (=PTRACERS_ref) |
137 |
c |
138 |
c NB: LS_fwflux is EmPmR |
139 |
|
140 |
DO j = jMin, jMax |
141 |
DO i = iMin, iMax |
142 |
surfaceForcingPTr(i,j,bi,bj,iTrc) = |
143 |
& surfaceForcingPTr(i,j,bi,bj,iTrc) |
144 |
& + LS_fwFlux(i,j,bi,bj) |
145 |
& *( PTRACERS_ref(ks,iTrc) - PTRACERS_EvPrRn(iTrc) ) |
146 |
& *mass2rUnit |
147 |
ENDDO |
148 |
ENDDO |
149 |
ENDIF |
150 |
|
151 |
ENDDO |
152 |
|
153 |
C- end local-surface-tracer / uniform-value distinction |
154 |
ENDIF |
155 |
|
156 |
ENDIF |
157 |
|
158 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
159 |
|
160 |
#endif /* ALLOW_LONGSTEP */ |
161 |
|
162 |
RETURN |
163 |
END |