/[MITgcm]/MITgcm/model/src/convective_weights.F
ViewVC logotype

Contents of /MITgcm/model/src/convective_weights.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.6 - (show annotations) (download)
Mon Mar 5 01:17:42 2012 UTC (12 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint65z, checkpoint65x, checkpoint65y, checkpoint65r, checkpoint65s, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint65j, checkpoint65k, checkpoint65h, checkpoint65i, checkpoint65n, checkpoint65l, checkpoint65m, checkpoint65b, checkpoint65c, checkpoint65a, checkpoint65f, checkpoint65g, checkpoint65d, checkpoint65e, checkpoint64, checkpoint65, checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint63p, checkpoint63q, checkpoint63r, checkpoint63s, checkpoint63l, checkpoint63m, checkpoint63n, checkpoint63o, checkpoint63k, checkpoint65o, checkpoint64y, checkpoint64x, checkpoint64z, checkpoint64q, checkpoint64p, checkpoint64s, checkpoint64r, checkpoint64u, checkpoint64t, checkpoint64w, checkpoint64v, checkpoint64i, checkpoint64h, checkpoint64k, checkpoint64j, checkpoint64m, checkpoint64l, checkpoint64o, checkpoint64n, checkpoint64a, checkpoint64c, checkpoint64b, checkpoint64e, checkpoint64d, checkpoint64g, checkpoint64f, HEAD
Changes since 1.5: +24 -23 lines
- fix description (comments)
- set output convectCount over the full array range (instead of doing
 an update): fix an issue when called within recomputation (adjoint)
 which could skip the initialisation from the caller S/R.

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

  ViewVC Help
Powered by ViewVC 1.1.22