1 |
C $Header: /u/gcmpack/MITgcm/pkg/frazil/frazil_calc_rhs.F,v 1.3 2012/03/04 23:11:20 dimitri Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "FRAZIL_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: FRAZIL_CALC_RHS |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE FRAZIL_CALC_RHS( |
11 |
I myTime, myIter, myThid ) |
12 |
|
13 |
C !DESCRIPTION: |
14 |
C Check water temperature and if colder than freezing |
15 |
C point bring excess negative heat to the surface. |
16 |
|
17 |
C !USES: =============================================================== |
18 |
IMPLICIT NONE |
19 |
#include "EEPARAMS.h" |
20 |
#include "SIZE.h" |
21 |
#include "PARAMS.h" |
22 |
#include "GRID.h" |
23 |
#include "DYNVARS.h" |
24 |
#include "FFIELDS.h" |
25 |
#ifdef ALLOW_FRAZIL |
26 |
# include "FRAZIL.h" |
27 |
#endif |
28 |
|
29 |
C !INPUT/OUTPUT PARAMETERS: |
30 |
C myTime :: current time in simulation |
31 |
C myIter :: current iteration number in simulation |
32 |
C myThid :: my Thread Id number |
33 |
_RL myTime |
34 |
INTEGER myIter |
35 |
INTEGER myThid |
36 |
CEOP |
37 |
|
38 |
#ifdef ALLOW_FRAZIL |
39 |
|
40 |
C !LOCAL VARIABLES: |
41 |
C Tfreezing :: freezing threshold temperature |
42 |
INTEGER bi,bj,i,j,k,kTop |
43 |
_RL Tfreezing, Tresid, pLoc, sLoc, tLoc |
44 |
_RL a0, a1, a2, b |
45 |
PARAMETER( a0 = -0.0575 _d 0 ) |
46 |
PARAMETER( a1 = 1.710523 _d -3 ) |
47 |
PARAMETER( a2 = -2.154996 _d -4 ) |
48 |
PARAMETER( b = -7.53 _d -4 ) |
49 |
|
50 |
_RL SW_TEMP |
51 |
EXTERNAL SW_TEMP |
52 |
|
53 |
DO bj=myByLo(myThid),myByHi(myThid) |
54 |
DO bi=myBxLo(myThid),myBxHi(myThid) |
55 |
|
56 |
C Initialize FrazilForcingT to zero |
57 |
DO k=1,Nr |
58 |
DO j=1-Oly,sNy+OLy |
59 |
DO i=1-Olx,sNx+Olx |
60 |
FrazilForcingT(i,j,k,bi,bj) = 0. _d 0 |
61 |
ENDDO |
62 |
ENDDO |
63 |
ENDDO |
64 |
|
65 |
C Check for water below freezing point. |
66 |
DO k = 2, Nr |
67 |
DO j=1-OLy,sNy+OLy |
68 |
DO i=1-OLx,sNx+OLx |
69 |
IF ( maskC(i,j,k-1,bi,bj) .NE. 0. _d 0 .AND. |
70 |
& maskC(i,j,k, bi,bj) .NE. 0. _d 0 ) THEN |
71 |
|
72 |
pLoc = ABS(RC(k)) |
73 |
sLoc = MAX(salt(i,j,k,bi,bj), 0. _d 0) |
74 |
tLoc = SW_TEMP(sLoc,theta(i,j,k,bi,bj),pLoc,0. _d 0) |
75 |
|
76 |
C Freezing point of seawater |
77 |
C REFERENCE: UNESCO TECH. PAPERS IN THE MARINE SCIENCE NO. 28. 1978 |
78 |
C EIGHTH REPORT JPOTS |
79 |
C ANNEX 6 FREEZING POINT OF SEAWATER F.J. MILLERO PP.29-35. |
80 |
C |
81 |
C UNITS: |
82 |
C PRESSURE P DECIBARS |
83 |
C SALINITY S PSS-78 |
84 |
C TEMPERATURE TF DEGREES CELSIUS |
85 |
C FREEZING PT. |
86 |
C************************************************************ |
87 |
C CHECKVALUE: TF= -2.588567 DEG. C FOR S=40.0, P=500. DECIBARS |
88 |
Tfreezing = (a0 + a1*sqrt(sLoc) + a2*sLoc) * sLoc + b*pLoc |
89 |
|
90 |
IF (tLoc .LT. Tfreezing) THEN |
91 |
C Move the negative heat to surface level. |
92 |
kTop = kSurfC(i,j,bi,bj) |
93 |
Tresid = ( Tfreezing - tloc ) |
94 |
& * HeatCapacity_Cp * rUnit2mass |
95 |
& * drF(k) * _hFacC(i,j,k,bi,bj) |
96 |
FrazilForcingT(i,j,k,bi,bj) = Tresid / dTtracerLev(k) |
97 |
FrazilForcingT(i,j,kTop,bi,bj) = |
98 |
& FrazilForcingT(i,j,kTop,bi,bj) |
99 |
& - Tresid / dTtracerLev(kTop) |
100 |
ENDIF |
101 |
ENDIF |
102 |
ENDDO |
103 |
ENDDO |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDDO |
107 |
|
108 |
# ifdef ALLOW_DIAGNOSTICS |
109 |
IF ( useDiagnostics ) THEN |
110 |
CALL DIAGNOSTICS_FILL( FrazilForcingT, 'FrzForcT', |
111 |
& 0,Nr, 0, 1, 1, myThid ) |
112 |
ENDIF |
113 |
# endif /* ALLOW_DIAGNOSTICS */ |
114 |
|
115 |
#endif /* ALLOW_FRAZIL */ |
116 |
|
117 |
RETURN |
118 |
END |