1 |
C $Header: /u/gcmpack/MITgcm/model/src/convective_weights.F,v 1.4 2003/10/15 22:55:01 jmc Exp $ |
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 |
#include "SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "PARAMS.h" |
30 |
#include "GRID.h" |
31 |
|
32 |
C !INPUT/OUTPUT PARAMETERS: |
33 |
C bi,bj,k - indices |
34 |
C rhoKm1 - rho in layer above |
35 |
C rhoK - rho in layer below |
36 |
C weightA - weight for level K |
37 |
C weightB - weight for level K+1 |
38 |
C ConvectCount - counter to diagnose where convection occurs |
39 |
C myThid - thread number |
40 |
INTEGER bi,bj,k |
41 |
_RL rhoKm1(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
42 |
_RL rhoK(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
43 |
_RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
44 |
_RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
45 |
_RL ConvectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
INTEGER myThid |
47 |
|
48 |
#ifdef INCLUDE_CONVECT_CALL |
49 |
|
50 |
C !LOCAL VARIABLES: |
51 |
C i,j :: Loop counter |
52 |
C dS,d1,d2 :: Layer thicknesses |
53 |
INTEGER i,j |
54 |
_RL dS,d1,d2 |
55 |
CEOP |
56 |
|
57 |
DO j=1-Oly,sNy+Oly |
58 |
DO i=1-Olx,sNx+Olx |
59 |
IF ( _hFacC(i,j,k-1,bi,bj) |
60 |
& *_hFacC(i,j,k,bi,bj) .GT. 0. |
61 |
& .AND. (rhokm1(i,j)-rhok(i,j))*rkSign*gravitySign .GT. 0. |
62 |
& ) THEN |
63 |
|
64 |
C Where statically unstable, mix the tracers conserving volume |
65 |
d1 = _hFacC(i,j,k-1,bi,bj)*drF(k-1) |
66 |
d2 = _hFacC(i,j, k ,bi,bj)*drF( k ) |
67 |
dS = d1+d2 |
68 |
weightA(i,j) = d2/dS |
69 |
weightB(i,j) = d1/dS |
70 |
ConvectCount(i,j,k) = ConvectCount(i,j,k) + 1. |
71 |
ELSE |
72 |
C Where statically stable, do nothing |
73 |
weightA(i,j) = 0. |
74 |
weightB(i,j) = 0. |
75 |
ENDIF |
76 |
ENDDO |
77 |
ENDDO |
78 |
|
79 |
#endif /* INCLUDE_CONVECT_CALL */ |
80 |
|
81 |
RETURN |
82 |
END |