File indexing completed on 2023-05-28 05:11:18 UTC
view on githubraw file Latest commit b4daa243 on 2023-05-28 03:53:22 UTC
b4daa24319 Shre*0001 #include "PTRACERS_OPTIONS.h"
0002
0003
0004
0005
0006
0007 SUBROUTINE PTRACERS_FORCING_SURF(
0008 I relaxForcingS,
0009 I bi, bj, iMin, iMax, jMin, jMax,
0010 I myTime,myIter,myThid )
0011
0012
0013
0014
0015
0016
0017
0018 IMPLICIT NONE
0019 #include "SIZE.h"
0020 #include "EEPARAMS.h"
0021 #include "PARAMS.h"
0022 #include "GRID.h"
0023 #include "SURFACE.h"
0024 #include "DYNVARS.h"
0025 #include "FFIELDS.h"
0026 #include "PTRACERS_SIZE.h"
0027 #include "PTRACERS_PARAMS.h"
0028 #include "PTRACERS_START.h"
0029 #include "PTRACERS_FIELDS.h"
0030
0031
0032
0033
0034
0035
0036
0037 _RL relaxForcingS(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0038 INTEGER bi, bj, iMin, iMax, jMin, jMax
0039 _RL myTime
0040 INTEGER myIter
0041 INTEGER myThid
0042
0043 #ifdef ALLOW_PTRACERS
0044
0045
0046
0047
0048
0049 INTEGER i, j
0050 INTEGER iTrc, ks
0051 _RL add2EmP(1-OLx:sNx+OLx,1-OLy:sNy+OLy)
0052 _RL epsil, cutoff, tmpVar
0053
0054
0055 IF ( usingPCoords ) THEN
0056 ks = Nr
0057 ELSE
0058 ks = 1
0059 ENDIF
0060
0061
0062 DO iTrc=1,PTRACERS_numInUse
0063
0064 DO j = jMin, jMax
0065 DO i = iMin, iMax
0066 surfaceForcingPTr(i,j,bi,bj,iTrc) = 0. _d 0
0067 & + surfaceForcingS(i,j,bi,bj)
0068 ENDDO
0069 ENDDO
0070
0071 ENDDO
0072
0073
0074 IF ( PTRACERS_addSrelax2EmP ) THEN
0075
0076
0077
0078 epsil = 1. _d -10
0079 cutoff = 0.1 _d 0 *drF(ks)/PTRACERS_dTLev(ks)
0080 IF ( ( (nonlinFreeSurf.GT.0 .OR. usingPCoords)
0081 & .AND. useRealFreshWaterFlux )
0082 & .OR.convertFW2Salt .EQ. -1. ) THEN
0083 DO j = jMin, jMax
0084 DO i = iMin, iMax
0085 tmpVar = MAX( salt(i,j,ks,bi,bj), epsil )
0086 add2EmP(i,j) = relaxForcingS(i,j)/tmpVar
0087 add2EmP(i,j) = rUnit2mass
0088 & *MAX( -cutoff, MIN( add2EmP(i,j), cutoff ) )
0089 ENDDO
0090 ENDDO
0091 ELSE
0092 DO j = jMin, jMax
0093 DO i = iMin, iMax
0094 add2EmP(i,j) = relaxForcingS(i,j)/convertFW2Salt
0095 add2EmP(i,j) = rUnit2mass
0096 & *MAX( -cutoff, MIN( add2EmP(i,j), cutoff ) )
0097 ENDDO
0098 ENDDO
0099 ENDIF
0100 #ifdef ALLOW_DIAGNOSTICS
0101 IF ( useDiagnostics ) THEN
0102 CALL DIAGNOSTICS_FILL(add2EmP,'Add2EmP ',0,1,2,bi,bj,myThid)
0103 ENDIF
0104 #endif /* ALLOW_DIAGNOSTICS */
0105 ELSE
0106 DO j = jMin, jMax
0107 DO i = iMin, iMax
0108 add2EmP(i,j) = 0. _d 0
0109 ENDDO
0110 ENDDO
0111 ENDIF
0112
0113
0114 #ifdef EXACT_CONSERV
0115 IF ( (nonlinFreeSurf.GT.0 .OR. usingPCoords)
0116 & .AND. useRealFreshWaterFlux ) THEN
0117
0118 DO iTrc=1,PTRACERS_numInUse
0119
0120
0121
0122
0123
0124 IF ( PTRACERS_StepFwd(iTrc) .AND.
0125 & PTRACERS_EvPrRn(iTrc).NE.UNSET_RL ) THEN
0126 DO j = jMin, jMax
0127 DO i = iMin, iMax
0128 surfaceForcingPTr(i,j,bi,bj,iTrc) =
0129 & surfaceForcingPTr(i,j,bi,bj,iTrc)
0130 & + ( PmEpR(i,j,bi,bj) - add2EmP(i,j) )
0131 & *( PTRACERS_EvPrRn(iTrc) - pTracer(i,j,ks,bi,bj,iTrc) )
0132 & *mass2rUnit
0133 ENDDO
0134 ENDDO
0135 ENDIF
0136
0137 ENDDO
0138
0139
0140 ELSE
0141 #else /* EXACT_CONSERV */
0142 IF (.TRUE.) THEN
0143 #endif /* EXACT_CONSERV */
0144
0145
0146
0147
0148 IF (convertFW2Salt .EQ. -1.) THEN
0149
0150
0151 DO iTrc=1,PTRACERS_numInUse
0152
0153 IF ( PTRACERS_StepFwd(iTrc) .AND.
0154 & PTRACERS_EvPrRn(iTrc).NE.UNSET_RL ) THEN
0155
0156
0157 DO j = jMin, jMax
0158 DO i = iMin, iMax
0159 surfaceForcingPTr(i,j,bi,bj,iTrc) =
0160 & surfaceForcingPTr(i,j,bi,bj,iTrc)
0161 & + ( EmPmR(i,j,bi,bj) + add2EmP(i,j) )
0162 & *( pTracer(i,j,ks,bi,bj,iTrc) - PTRACERS_EvPrRn(iTrc) )
0163 & *mass2rUnit
0164 ENDDO
0165 ENDDO
0166 ENDIF
0167
0168 ENDDO
0169
0170 ELSE
0171
0172
0173 DO iTrc=1,PTRACERS_numInUse
0174
0175 IF ( PTRACERS_StepFwd(iTrc) .AND.
0176 & PTRACERS_EvPrRn(iTrc).NE.UNSET_RL ) THEN
0177
0178
0179 DO j = jMin, jMax
0180 DO i = iMin, iMax
0181 surfaceForcingPTr(i,j,bi,bj,iTrc) =
0182 & surfaceForcingPTr(i,j,bi,bj,iTrc)
0183 & + ( EmPmR(i,j,bi,bj) + add2EmP(i,j) )
0184 & *( PTRACERS_ref(ks,iTrc) - PTRACERS_EvPrRn(iTrc) )
0185 & *mass2rUnit
0186 ENDDO
0187 ENDDO
0188 ENDIF
0189
0190 ENDDO
0191
0192
0193 ENDIF
0194
0195 ENDIF
0196
0197
0198
0199 #endif /* ALLOW_PTRACERS */
0200
0201 RETURN
0202 END