1 |
adcroft |
1.1 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: CONVECTIVE_WEIGHTS |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE CONVECTIVE_WEIGHTS( |
10 |
|
|
I bi,bj,k,rhoKm1,rhoK, |
11 |
|
|
O weightA,weightB,ConvectCount, |
12 |
|
|
I myThid) |
13 |
|
|
C !DESCRIPTION: |
14 |
|
|
C Calculates the weights used to represent convective mixing |
15 |
|
|
C between two layers. |
16 |
|
|
C |
17 |
|
|
C Mixing is represented by: |
18 |
|
|
C T(k-1) = T(k-1) + B * ( T(k) - T(k-1) ) |
19 |
|
|
C T(k) = T(k) + A * ( T(k-1) - T(k) ) |
20 |
|
|
C |
21 |
|
|
C In the stable case, A = B = 0 |
22 |
|
|
C In the unstable case, A and B are non-zero and are chosen so as to |
23 |
|
|
C conserve total volume of T. |
24 |
|
|
|
25 |
|
|
C !USES: |
26 |
|
|
IMPLICIT NONE |
27 |
|
|
C == Global data == |
28 |
|
|
#include "SIZE.h" |
29 |
|
|
#include "EEPARAMS.h" |
30 |
|
|
#include "PARAMS.h" |
31 |
|
|
#include "GRID.h" |
32 |
|
|
|
33 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
34 |
|
|
C == Routine arguments == |
35 |
|
|
C bi,bj,k - indices |
36 |
|
|
C rhoKm1 - rho in layer above |
37 |
|
|
C rhoK - rho in layer below |
38 |
|
|
C weightA - weight for level K |
39 |
|
|
C weightB - weight for level K+1 |
40 |
|
|
C ConvectCount - counter to diagnose where convection occurs |
41 |
|
|
C myThid - thread number |
42 |
|
|
INTEGER bi,bj,k |
43 |
|
|
_RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
44 |
|
|
_RL rhoK(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
45 |
|
|
_RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
|
|
_RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
47 |
|
|
_RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
48 |
|
|
INTEGER myThid |
49 |
|
|
|
50 |
|
|
#ifdef INCLUDE_CONVECT_CALL |
51 |
|
|
|
52 |
|
|
C !LOCAL VARIABLES: |
53 |
|
|
C == Local variables == |
54 |
|
|
C i,j :: Loop counter |
55 |
|
|
C dS,d1,d2 :: Layer thicknesses |
56 |
|
|
INTEGER i,j |
57 |
|
|
_RL dS,d1,d2 |
58 |
|
|
CEOP |
59 |
|
|
|
60 |
|
|
DO j=1-Oly,sNy+Oly |
61 |
|
|
DO i=1-Olx,sNx+Olx |
62 |
|
|
IF ( _hFacC(i,j,k-1,bi,bj) |
63 |
|
|
& *_hFacC(i,j,k,bi,bj) .GT. 0. |
64 |
|
|
& .AND. rhokm1(i,j) .GT. rhok(i,j) ) THEN |
65 |
|
|
|
66 |
|
|
C Where statically unstable, mix the tracers conserving volume |
67 |
|
|
d1 = _hFacC(i,j,k-1,bi,bj)*drF(k-1) |
68 |
|
|
d2 = _hFacC(i,j, k ,bi,bj)*drF( k ) |
69 |
|
|
dS = d1+d2 |
70 |
|
|
weightA(i,j) = d2/dS |
71 |
|
|
weightB(i,j) = d1/dS |
72 |
|
|
ConvectCount(i,j,k) = ConvectCount(i,j,k) + 1. |
73 |
|
|
ELSE |
74 |
|
|
C Where statically stable, do nothing |
75 |
|
|
weightA(i,j) = 0. |
76 |
|
|
weightB(i,j) = 0. |
77 |
|
|
ENDIF |
78 |
|
|
ENDDO |
79 |
|
|
ENDDO |
80 |
|
|
|
81 |
|
|
#endif /* INCLUDE_CONVECT_CALL */ |
82 |
|
|
|
83 |
|
|
RETURN |
84 |
|
|
END |