1 |
torge |
1.2 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/diffus.F,v 1.18 2012/11/09 22:15:18 heimbach Exp $ |
2 |
torge |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "SEAICE_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: DIFFUS |
8 |
|
|
C !INTERFACE: |
9 |
|
|
SUBROUTINE DIFFUS( |
10 |
|
|
U fld, |
11 |
|
|
I DIFFA, iceMsk, myThid ) |
12 |
|
|
|
13 |
|
|
C !DESCRIPTION: \bv |
14 |
|
|
C *==========================================================* |
15 |
|
|
C | S/R DIFFUS |
16 |
|
|
C | o Calculate laplacian of input field |
17 |
|
|
C | and return the result in the same array |
18 |
|
|
C *==========================================================* |
19 |
|
|
C \ev |
20 |
|
|
|
21 |
|
|
C !USES: |
22 |
|
|
IMPLICIT NONE |
23 |
|
|
|
24 |
|
|
C == Global variables === |
25 |
|
|
#include "SIZE.h" |
26 |
|
|
#include "EEPARAMS.h" |
27 |
|
|
#include "GRID.h" |
28 |
|
|
#include "SEAICE_SIZE.h" |
29 |
|
|
#include "SEAICE_PARAMS.h" |
30 |
|
|
|
31 |
|
|
C !INPUT/OUTPUT PARAMETERS: |
32 |
|
|
C == Routine Arguments == |
33 |
|
|
C fld :: In: input ice-field ; Out: laplacian of input field |
34 |
|
|
C DIFFA :: grid length scale |
35 |
|
|
C iceMsk :: Ocean/Land mask |
36 |
|
|
C myThid :: my Thread Id. number |
37 |
|
|
_RL fld (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
38 |
|
|
_RL DIFFA (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
39 |
|
|
_RL iceMsk (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
40 |
|
|
INTEGER myThid |
41 |
|
|
CEOP |
42 |
|
|
|
43 |
|
|
C !LOCAL VARIABLES: |
44 |
|
|
C == Local variables == |
45 |
|
|
C i,j,bi,bj :: Loop counters |
46 |
|
|
INTEGER i, j, bi, bj |
47 |
|
|
_RL DELTXX, DELTYY |
48 |
|
|
_RL tmpFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
|
|
_RL dfx (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
50 |
|
|
_RL dfy (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
|
|
|
52 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
53 |
|
|
|
54 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
55 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
56 |
|
|
IF ( SEAICEuseFluxForm ) THEN |
57 |
|
|
C-- Use flux form for MITgcm compliance, unfortunately changes results |
58 |
|
|
|
59 |
|
|
DO j=1-Oly,sNy+Oly |
60 |
|
|
DO i=1-Olx,sNx+Olx |
61 |
|
|
dfx(i,j) = 0. _d 0 |
62 |
|
|
dfy(i,j) = 0. _d 0 |
63 |
|
|
ENDDO |
64 |
|
|
ENDDO |
65 |
|
|
C-- first compute fluxes across cell faces |
66 |
|
|
DO j=1,sNy+1 |
67 |
|
|
DO i=1,sNx+1 |
68 |
|
|
dfx(i,j) = _dyG(i,j,bi,bj) * _recip_dxC(i,j,bi,bj) |
69 |
|
|
& * (fld(i,j,bi,bj)-fld(i-1,j,bi,bj)) |
70 |
|
|
& * cosFacU(j,bi,bj) |
71 |
|
|
& * iceMsk(i,j,bi,bj)*iceMsk(i-1,j,bi,bj) |
72 |
|
|
& * ( DIFFA(i,j,bi,bj)+DIFFA(i-1,j,bi,bj) )*HALF |
73 |
|
|
#ifdef ALLOW_OBCS |
74 |
|
|
& * maskInW(i,j,bi,bj) |
75 |
|
|
#endif |
76 |
|
|
dfy(i,j) = _dxG(i,j,bi,bj) * _recip_dyC(i,j,bi,bj) |
77 |
|
|
& * (fld(i,j,bi,bj)-fld(i,j-1,bi,bj)) |
78 |
|
|
#ifdef ISOTROPIC_COS_SCALING |
79 |
|
|
& * cosFacV(j,bi,bj) |
80 |
|
|
#endif |
81 |
|
|
& * iceMsk(i,j,bi,bj)*iceMsk(i,j-1,bi,bj) |
82 |
|
|
& * ( DIFFA(i,j,bi,bj)+DIFFA(i,j-1,bi,bj) )*HALF |
83 |
|
|
#ifdef ALLOW_OBCS |
84 |
|
|
& * maskInS(i,j,bi,bj) |
85 |
|
|
#endif |
86 |
|
|
ENDDO |
87 |
|
|
ENDDO |
88 |
|
|
DO j=1-OLy,sNy+OLy |
89 |
|
|
DO i=1-OLx,sNx+OLx |
90 |
|
|
fld(i,j,bi,bj) = 0. _d 0 |
91 |
|
|
ENDDO |
92 |
|
|
ENDDO |
93 |
|
|
C-- compute Laplacian as flux divergence |
94 |
|
|
DO j=1,sNy |
95 |
|
|
DO i=1,sNx |
96 |
|
|
fld(i,j,bi,bj) = ( |
97 |
|
|
& ( dfx(i+1,j) - dfx(i,j) ) |
98 |
|
|
& + ( dfy(i,j+1) - dfy(i,j) ) |
99 |
|
|
& ) * recip_rA(i,j,bi,bj) |
100 |
|
|
ENDDO |
101 |
|
|
ENDDO |
102 |
|
|
|
103 |
|
|
ELSE |
104 |
|
|
C NOW DO DIFFUSION WITH NUIT CONVERSION |
105 |
|
|
|
106 |
|
|
DO j=1-OLy,sNy+OLy |
107 |
|
|
DO i=1-OLx,sNx+OLx |
108 |
|
|
tmpFld(i,j) = 0.0 _d 0 |
109 |
|
|
ENDDO |
110 |
|
|
ENDDO |
111 |
|
|
|
112 |
|
|
DO j=1,sNy |
113 |
|
|
DO i=1,sNx |
114 |
|
|
DELTXX = DIFFA(i,j,bi,bj) |
115 |
|
|
& * _recip_dxF(i,j,bi,bj)*_recip_dxF(i,j,bi,bj) |
116 |
|
|
DELTYY = DIFFA(i,j,bi,bj) |
117 |
|
|
& * _recip_dyF(i,j,bi,bj)*_recip_dyF(i,j,bi,bj) |
118 |
|
|
& * _recip_dxF(i,j,bi,bj) |
119 |
|
|
tmpFld(i,j) = |
120 |
|
|
& DELTXX*( |
121 |
|
|
& (fld(i+1,j,bi,bj)-fld(i, j,bi,bj)) |
122 |
|
|
& *iceMsk(i+1,j,bi,bj) |
123 |
|
|
#ifdef ALLOW_OBCS |
124 |
|
|
& *maskInW(i+1,j,bi,bj) |
125 |
|
|
#endif |
126 |
|
|
& -(fld(i, j,bi,bj)-fld(i-1,j,bi,bj)) |
127 |
|
|
& *iceMsk(i-1,j,bi,bj) |
128 |
|
|
#ifdef ALLOW_OBCS |
129 |
|
|
& *maskInW(i,j,bi,bj) |
130 |
|
|
#endif |
131 |
|
|
& ) |
132 |
|
|
& +DELTYY*( |
133 |
|
|
& (fld(i,j+1,bi,bj)-fld(i,j, bi,bj)) |
134 |
|
|
& * _dxG(i,j+1,bi,bj)*iceMsk(i,j+1,bi,bj) |
135 |
|
|
#ifdef ALLOW_OBCS |
136 |
|
|
& *maskInS(i,j+1,bi,bj) |
137 |
|
|
#endif |
138 |
|
|
& -(fld(i,j, bi,bj)-fld(i,j-1,bi,bj)) |
139 |
|
|
& * _dxG(i,j, bi,bj)*iceMsk(i,j-1,bi,bj) |
140 |
|
|
#ifdef ALLOW_OBCS |
141 |
|
|
& *maskInS(i,j,bi,bj) |
142 |
|
|
#endif |
143 |
|
|
& ) |
144 |
|
|
ENDDO |
145 |
|
|
ENDDO |
146 |
|
|
DO j=1-OLy,sNy+OLy |
147 |
|
|
DO i=1-OLx,sNx+OLx |
148 |
|
|
fld(i,j,bi,bj) = tmpFld(i,j) |
149 |
|
|
ENDDO |
150 |
|
|
ENDDO |
151 |
|
|
|
152 |
|
|
C-- end flux-form / non flux-form |
153 |
|
|
ENDIF |
154 |
|
|
ENDDO |
155 |
|
|
ENDDO |
156 |
|
|
|
157 |
|
|
RETURN |
158 |
|
|
END |