1 |
C $Header: /u/gcmpack/MITgcm/pkg/generic_advdiff/gad_som_lim_r.F,v 1.1 2007/01/16 04:38:35 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GAD_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GAD_SOM_LIM_R |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE GAD_SOM_LIM_R( |
11 |
I bi,bj, limiter, |
12 |
U sm_v, sm_o, sm_x, sm_y, sm_z, |
13 |
U sm_xx, sm_yy, sm_zz, sm_xy, sm_xz, sm_yz, |
14 |
I myThid ) |
15 |
|
16 |
C !DESCRIPTION: |
17 |
C Apply limiter before calculating vertical advection |
18 |
C Second-Order Moments Advection of tracer in Z-direction |
19 |
C ref: M.J.Prather, 1986, JGR, 91, D6, pp 6671-6681. |
20 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
21 |
|
22 |
C !USES: =============================================================== |
23 |
IMPLICIT NONE |
24 |
#include "SIZE.h" |
25 |
c #include "GRID.h" |
26 |
#include "GAD.h" |
27 |
|
28 |
C !INPUT PARAMETERS: =================================================== |
29 |
C bi,bj :: tile indices |
30 |
C limiter :: 0: no limiter ; 1: Prather, 1986 limiter |
31 |
C myThid :: my Thread Id. number |
32 |
INTEGER bi,bj |
33 |
INTEGER limiter |
34 |
c _RL tracer(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
35 |
INTEGER myThid |
36 |
|
37 |
C !OUTPUT PARAMETERS: ================================================== |
38 |
C sm_v :: volume of grid cell |
39 |
C sm_o :: tracer content of grid cell (zero order moment) |
40 |
C sm_x,y,z :: 1rst order moment of tracer distribution, in x,y,z direction |
41 |
C sm_xx,yy,zz :: 2nd order moment of tracer distribution, in x,y,z direction |
42 |
C sm_xy,xz,yz :: 2nd order moment of tracer distr., in cross direction xy,xz,yz |
43 |
_RL sm_v (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
44 |
_RL sm_o (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
45 |
_RL sm_x (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
46 |
_RL sm_y (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
47 |
_RL sm_z (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
48 |
_RL sm_xx (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
49 |
_RL sm_yy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
50 |
_RL sm_zz (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
51 |
_RL sm_xy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
52 |
_RL sm_xz (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
53 |
_RL sm_yz (1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
54 |
|
55 |
#ifdef GAD_ALLOW_SOM_ADVECT |
56 |
C !LOCAL VARIABLES: ==================================================== |
57 |
C i,j,k :: loop indices |
58 |
_RL three |
59 |
PARAMETER( three = 3. _d 0 ) |
60 |
INTEGER i,j,k |
61 |
_RL slpmax, s1max, s1new, s2new |
62 |
CEOP |
63 |
|
64 |
IF ( limiter.EQ.1 ) THEN |
65 |
DO k=1,Nr |
66 |
DO j=jMinAdvR,jMaxAdvR |
67 |
DO i=iMinAdvR,iMaxAdvR |
68 |
C If flux-limiting transport is to be applied, place limits on |
69 |
C appropriate moments before transport. |
70 |
slpmax = 0. |
71 |
IF ( sm_o(i,j,k).GT.0. ) slpmax = sm_o(i,j,k) |
72 |
s1max = slpmax*1.5 _d 0 |
73 |
s1new = MIN( s1max, MAX(-s1max,sm_z(i,j,k)) ) |
74 |
s2new = MIN( (slpmax+slpmax-ABS(s1new)/three), |
75 |
& MAX(ABS(s1new)-slpmax,sm_zz(i,j,k)) ) |
76 |
sm_xz(i,j,k) = MIN( slpmax, MAX(-slpmax,sm_xz(i,j,k)) ) |
77 |
sm_yz(i,j,k) = MIN( slpmax, MAX(-slpmax,sm_yz(i,j,k)) ) |
78 |
sm_z (i,j,k) = s1new ; |
79 |
sm_zz(i,j,k) = s2new ; |
80 |
ENDDO |
81 |
ENDDO |
82 |
ENDDO |
83 |
ENDIF |
84 |
|
85 |
#endif /* GAD_ALLOW_SOM_ADVECT */ |
86 |
|
87 |
RETURN |
88 |
END |