File indexing completed on 2024-05-25 05:11:13 UTC
view on githubraw file Latest commit 00f81e67 on 2024-05-24 21:00:12 UTC
00f81e6785 Ou W*0001 #include "STIC_OPTIONS.h"
0002 #ifdef ALLOW_SHELFICE
0003 # include "SHELFICE_OPTIONS.h"
0004 #endif
0005
0006
0007
0008
0009 SUBROUTINE STIC_SOLVE4FLUXES(
0010 I tLoc, sLoc, pLoc,
0011 I gammaT, gammaS,
0012 I iceConductionDistance, thetaIceConduction,
0013 O heatFlux, fwFlux,
0014 O forcingT, forcingS,
0015 O insitutLoc,
0016 I bi, bj, myTime, myIter, myThid )
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 IMPLICIT NONE
0027
0028
0029 #include "SIZE.h"
0030 #include "EEPARAMS.h"
0031 #include "PARAMS.h"
0032 #ifdef ALLOW_SHELFICE
0033 # include "SHELFICE.h"
0034 #endif
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 _RL tLoc, sLoc, pLoc
0056 _RL gammaT, gammaS
0057 _RL iceConductionDistance, thetaIceConduction
0058 _RL heatFlux, fwFlux, forcingT, forcingS, insitutLoc
0059 INTEGER bi, bj
0060 _RL myTime
0061 INTEGER myIter, myThid
0062
0063
0064 #ifndef ALLOW_OPENAD
0065 _RL SW_TEMP
0066 EXTERNAL SW_TEMP
0067 #endif
0068
0069
0070
0071 _RL thetaFreeze, saltFreeze
0072 _RL eps1, eps2, eps3, eps4, eps6, eps7, eps8
0073 _RL aqe, bqe, cqe, discrim, recip_aqe
0074 _RL a0, b0, c0
0075 _RL w_B
0076 CHARACTER*(MAX_LEN_MBUF) msgBuf
0077
0078
0079
0080
0081
0082
0083
0084
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 a0 = -0.0575 _d 0
0100 c0 = 0.0901 _d 0
0101 b0 = -7.61 _d -4
0102
0103
0104 insitutLoc = SW_TEMP(sLoc,tLoc,pLoc, zeroRL)
0105
0106
0107 eps1 = rUnit2mass*HeatCapacity_Cp * gammaT
0108 eps2 = rUnit2mass*SHELFICElatentHeat * gammaS
0109 eps3 = rhoSHELFICE*SHELFICEheatCapacity_Cp * SHELFICEkappa
0110 & /iceConductionDistance;
0111 eps4 = b0*pLoc + c0
0112 eps6 = eps4 - insitutLoc
0113 eps7 = eps4 - thetaIceConduction
0114
0115 IF ( debugLevel.GE.debLevE ) THEN
0116 WRITE(msgBuf,'(A,9E16.8)')
0117 & 'r2mass, Cp, gmaT,SIlh,gmaS, rhoSI, SI_Cp, Kap, ICondDis ',
0118 & rUnit2mass,HeatCapacity_Cp,gammaT, SHELFICElatentHeat,gammaS,
0119 & rhoSHELFICE, SHELFICEheatCapacity_Cp, SHELFICEkappa,
0120 & iceConductionDistance
0121
0122 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0123 & SQUEEZE_RIGHT , 1)
0124 ENDIF
0125
0126
0127
0128 IF (SHELFICEadvDiffHeatFlux .EQV. .FALSE.) THEN
0129 aqe = a0*(eps1 + eps3)
0130 bqe = eps1*eps6 + eps3*eps7 - eps2 - SHELFICEsalinity*aqe
0131 cqe = eps2 * sLoc - SHELFICEsalinity*(eps1*eps6 + eps3*eps7)
0132
0133
0134
0135
0136 ELSE
0137 eps8 = rUnit2mass * gammaS * SHELFICEheatCapacity_Cp
0138 aqe = a0 *(eps1 - eps8)
0139 bqe = eps1*eps6 + sLoc*eps8*a0 - eps8*eps7 - eps2 -
0140 & SHELFICEsalinity*eps1*a0
0141 cqe = sLoc*(eps8*eps7 + eps2) - SHELFICEsalinity*eps1
0142 ENDIF
0143
0144
0145 recip_aqe = 0. _d 0
0146 IF ( aqe .NE. 0. _d 0 ) recip_aqe = 0.5 _d 0/aqe
0147
0148
0149 discrim = bqe*bqe - 4. _d 0*aqe*cqe
0150
0151
0152 saltFreeze = (- bqe - SQRT(discrim))*recip_aqe
0153
0154
0155
0156 IF ( saltFreeze .LT. 0. _d 0 ) THEN
0157 saltFreeze = (- bqe + SQRT(discrim))*recip_aqe
0158 ENDIF
0159
0160
0161 thetaFreeze = a0*saltFreeze + eps4
0162
0163
0164
0165
0166
0167
0168
0169 IF (SHELFICEadvDiffHeatFlux .EQV. .FALSE.) THEN
0170
0171
0172
0173 fwFlux = 1/SHELFICElatentHeat*(
0174 & eps3*(thetaFreeze - thetaIceConduction) -
0175 & eps1*(insitutLoc - thetaFreeze) )
0176
0177
0178
0179 ELSE
0180 fwFlux =
0181 & eps1 * ( thetaFreeze - insitutLoc ) /
0182 & (SHELFICElatentHeat + SHELFICEheatCapacity_Cp*
0183 & (thetaFreeze - thetaIceConduction))
0184 ENDIF
0185
0186
0187
0188
0189
0190
0191
0192
0193 IF ((SHELFICEadvDiffHeatFlux .EQV. .TRUE.) .AND.
0194 & (fwFlux .GT. zeroRL)) THEN
0195 aqe = a0 *(eps1)
0196 bqe = eps1*eps6 - eps2 - SHELFICEsalinity*eps1*a0
0197 cqe = sLoc*(eps2) - SHELFICEsalinity*eps1
0198
0199 recip_aqe = 0. _d 0
0200 IF ( aqe .NE. 0. _d 0 ) recip_aqe = 0.5 _d 0/aqe
0201
0202 discrim = bqe*bqe - 4. _d 0*aqe*cqe
0203 saltFreeze = (- bqe - SQRT(discrim))*recip_aqe
0204 IF ( saltFreeze .LT. 0. _d 0 ) THEN
0205 saltFreeze = (- bqe + SQRT(discrim))*recip_aqe
0206 ENDIF
0207
0208 thetaFreeze = a0*saltFreeze + eps4
0209
0210 fwFlux =
0211 & eps1 * ( thetaFreeze - insitutLoc ) /
0212 & SHELFICElatentHeat
0213 ENDIF
0214
0215
0216
0217 w_B = fwFlux * mass2rUnit
0218
0219
0220
0221
0222
0223
0224
0225
0226
0227 IF (SHELFICEconserve) THEN
0228
0229
0230
0231
0232 IF (useRealFreshWaterFlux ) THEN
0233
0234
0235
0236
0237
0238
0239 heatFlux = rUnit2mass*HeatCapacity_Cp * (
0240 & gammaT * (insitutLoc - thetaFreeze)
0241 & + w_B * (thetaFreeze - insitutLoc + tLoc) )
0242 ELSE
0243
0244
0245
0246
0247 heatFlux = rUnit2mass*HeatCapacity_Cp * (
0248 & gammaT * (insitutLoc - thetaFreeze)
0249 & + w_B * (thetaFreeze - insitutLoc) )
0250 ENDIF
0251
0252 ELSE
0253
0254
0255 heatFlux = rUnit2mass*HeatCapacity_Cp *
0256 & gammaT * (insitutLoc - thetaFreeze)
0257 ENDIF
0258
0259
0260
0261
0262
0263
0264 IF (SHELFICEconserve) THEN
0265
0266
0267
0268 forcingT =
0269 & (gammaT - w_B)*(thetaFreeze - insitutLoc)
0270
0271
0272 forcingS =
0273 & (gammaS - w_B)*(saltFreeze - sLoc)
0274 ELSE
0275
0276
0277 forcingT = gammaT * ( thetaFreeze - insitutLoc )
0278 forcingS = gammaS * ( saltFreeze - sLoc )
0279 ENDIF
0280
0281 IF ( debugLevel.GE.debLevE ) THEN
0282 WRITE(msgBuf,'(A,7E16.8)')
0283 & 'aqe, bqe, ceq ',
0284 & aqe,bqe,cqe
0285
0286 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0287 & SQUEEZE_RIGHT , 1)
0288
0289 WRITE(msgBuf,'(A,7E16.8)')
0290 & 'T,S,P,t,TFrz,SFrz,w_B ',
0291 & tLoc,sLoc,pLoc, insitutLoc, thetaFreeze, saltFreeze, w_B
0292
0293 CALL PRINT_MESSAGE( msgBuf, standardMessageUnit,
0294 & SQUEEZE_RIGHT , 1)
0295 ENDIF
0296
0297 RETURN
0298 END