1 |
C $Header: /u/gcmpack/MITgcm/pkg/pp81/pp81_calc.F,v 1.2 2004/10/17 23:12:59 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "PP81_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: PP81_CALC |
8 |
|
9 |
C !INTERFACE: ======================================================= |
10 |
subroutine PP81_CALC( |
11 |
I bi, bj, myTime, myThid ) |
12 |
|
13 |
C !DESCRIPTION: \bv |
14 |
C /==========================================================\ |
15 |
C | SUBROUTINE PP81_CALC | |
16 |
C | o Compute all PP81 fields defined in PP81.h | |
17 |
C |==========================================================| |
18 |
C | This subroutine is based on SPEM code | |
19 |
C \==========================================================/ |
20 |
IMPLICIT NONE |
21 |
C |
22 |
C-------------------------------------------------------------------- |
23 |
|
24 |
C global parameters updated by pp_calc |
25 |
C PPviscAz - PP eddy viscosity coefficient (m^2/s) |
26 |
C PPdiffKzT - PP diffusion coefficient for temperature (m^2/s) |
27 |
C |
28 |
C \ev |
29 |
|
30 |
C !USES: ============================================================ |
31 |
#include "SIZE.h" |
32 |
#include "EEPARAMS.h" |
33 |
#include "PARAMS.h" |
34 |
#include "DYNVARS.h" |
35 |
#include "PP81.h" |
36 |
#include "FFIELDS.h" |
37 |
#include "GRID.h" |
38 |
#ifdef ALLOW_AUTODIFF_TAMC |
39 |
#include "tamc.h" |
40 |
#include "tamc_keys.h" |
41 |
#else /* ALLOW_AUTODIFF_TAMC */ |
42 |
integer ikppkey |
43 |
#endif /* ALLOW_AUTODIFF_TAMC */ |
44 |
|
45 |
C !INPUT PARAMETERS: =================================================== |
46 |
c Routine arguments |
47 |
c bi, bj - array indices on which to apply calculations |
48 |
c myTime - Current time in simulation |
49 |
|
50 |
INTEGER bi, bj |
51 |
INTEGER myThid |
52 |
_RL myTime |
53 |
|
54 |
#ifdef ALLOW_PP81 |
55 |
|
56 |
C !LOCAL VARIABLES: ==================================================== |
57 |
c Local constants |
58 |
C imin, imax, jmin, jmax - array computation indices |
59 |
C RiNumber - Richardson Number |
60 |
INTEGER I, J, K |
61 |
INTEGER iMin ,iMax ,jMin ,jMax |
62 |
_RL denom, PPviscTmp |
63 |
_RL RiNumber(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
64 |
CEOP |
65 |
iMin = 2-OLx |
66 |
iMax = sNx+OLx-1 |
67 |
jMin = 2-OLy |
68 |
jMax = sNy+OLy-1 |
69 |
|
70 |
DO K = 2, Nr |
71 |
CALL PP81_RI_NUMBER( |
72 |
I bi, bj, K, iMin, iMax, jMin, jMax, |
73 |
O RiNumber, |
74 |
I myTime, myThid ) |
75 |
DO J=jMin,jMax |
76 |
DO I=iMin,iMax |
77 |
IF ( RiNumber(I,J) .LT. RiLimit ) THEN |
78 |
denom = 1.0 + PPalpha*RiLimit |
79 |
PPviscTmp = PPviscMax |
80 |
ELSE |
81 |
denom = 1.0 + PPalpha*RiNumber(I,J) |
82 |
PPviscTmp = PPnu0/(denom**PPnRi) |
83 |
ENDIF |
84 |
C assign a minium ( = background ) value |
85 |
PPviscAr(I,J,K,bi,bj) = MAX(PPviscTmp,viscAr) |
86 |
PPdiffKr(I,J,K,bi,bj) = MAX(PPviscAr(I,J,K,bi,bj)/denom, |
87 |
& diffKrNrT(k)) |
88 |
CML if ( k.eq.2 .and. i.ge.1 .and. i.le.sNx .and. j.eq.1) |
89 |
CML & print '(A,3I3,5E14.5)', 'ml-pp81', I,J,K, RiLimit, |
90 |
CML & RiNumber(I,J),denom, |
91 |
CML & PPviscAr(I,J,K,bi,bj), PPdiffKr(I,J,K,bi,bj) |
92 |
ENDDO |
93 |
ENDDO |
94 |
#ifdef ALLOW_PP81_LOWERBOUND |
95 |
CRT This is where the lower limit for subsurface layers |
96 |
CRT (BRIOS special) is set. |
97 |
IF ( (buoyancyRelation .EQ. 'OCEANIC' .AND. K .EQ. 2) .OR. |
98 |
& (buoyancyRelation .EQ. 'OCEANICP' .AND. K .EQ. Nr) ) THEN |
99 |
DO J=jMin,jMax |
100 |
DO I=iMin,iMax |
101 |
PPviscAr(I,J,K,bi,bj) = MAX(PPviscMin,PPviscAr(I,J,K,bi,bj)) |
102 |
PPdiffKr(I,J,K,bi,bj) = MAX(PPdiffMin,PPdiffKr(I,J,K,bi,bj)) |
103 |
ENDDO |
104 |
ENDDO |
105 |
ENDIF |
106 |
#endif /* ALLOW_PP81_LOWERBOUND */ |
107 |
C Mask land points |
108 |
DO J=jMin,jMax |
109 |
DO I=iMin,iMax |
110 |
PPviscAr(I,J,K,bi,bj) = PPviscAr(I,J,K,bi,bj) |
111 |
& * maskC(I,J,K,bi,bj) |
112 |
PPdiffKr(I,J,K,bi,bj) = PPdiffKr(I,J,K,bi,bj) |
113 |
& * maskC(I,J,K,bi,bj) |
114 |
ENDDO |
115 |
ENDDO |
116 |
C end K-loop |
117 |
ENDDO |
118 |
|
119 |
#endif /* ALLOW_PP81 */ |
120 |
|
121 |
RETURN |
122 |
END |
123 |
|