1 |
C $Header: /u/gcmpack/MITgcm/model/src/convective_weights.F,v 1.5 2005/06/22 00:25:32 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 |
|
14 |
C !DESCRIPTION: |
15 |
C Calculates the weights used to represent convective mixing |
16 |
C between two layers. |
17 |
C |
18 |
C Mixing is represented by: |
19 |
C T(k-1) = T(k-1) + A * ( T(k) - T(k-1) ) |
20 |
C T(k) = T(k) + B * ( T(k-1) - T(k) ) |
21 |
C |
22 |
C In the stable case, A = B = 0 |
23 |
C In the unstable case, A and B are non-zero and are chosen so as to |
24 |
C conserve total volume of T. |
25 |
|
26 |
C !USES: |
27 |
IMPLICIT NONE |
28 |
#include "SIZE.h" |
29 |
#include "EEPARAMS.h" |
30 |
#include "PARAMS.h" |
31 |
#include "GRID.h" |
32 |
|
33 |
C !INPUT/OUTPUT PARAMETERS: |
34 |
C bi,bj,k :: indices |
35 |
C rhoKm1 :: rho in level k-1 |
36 |
C rhoK :: rho in level k |
37 |
C weightA :: weight for tracer @ level k-1 |
38 |
C weightB :: weight for tracer @ level k |
39 |
C convectCount :: counter to diagnose where convection occurs |
40 |
C myThid :: my Thread Id number |
41 |
INTEGER bi,bj,k |
42 |
_RL rhoKm1 (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
43 |
_RL rhoK (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
44 |
_RL weightA(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
45 |
_RL weightB(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
_RL convectCount(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
47 |
INTEGER myThid |
48 |
|
49 |
#ifdef INCLUDE_CONVECT_CALL |
50 |
|
51 |
C !LOCAL VARIABLES: |
52 |
C i,j :: Loop counter |
53 |
C dS,d1,d2 :: Layer thicknesses |
54 |
INTEGER i,j |
55 |
_RL dS,d1,d2 |
56 |
CEOP |
57 |
|
58 |
DO j=1-OLy,sNy+OLy |
59 |
DO i=1-OLx,sNx+OLx |
60 |
IF ( _hFacC(i,j,k-1,bi,bj)* _hFacC(i,j,k,bi,bj) .GT. 0. .AND. |
61 |
& (rhok(i,j)-rhokm1(i,j))*rkSign*gravitySign .LT. 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) = 1. |
71 |
ELSE |
72 |
C Where statically stable, do nothing |
73 |
weightA(i,j) = 0. |
74 |
weightB(i,j) = 0. |
75 |
convectCount(i,j,k) = 0. |
76 |
ENDIF |
77 |
ENDDO |
78 |
ENDDO |
79 |
|
80 |
#endif /* INCLUDE_CONVECT_CALL */ |
81 |
|
82 |
RETURN |
83 |
END |