1 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_diffusion.F,v 1.9 2012/11/09 22:15:18 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SEAICE_OPTIONS.h" |
5 |
#ifdef ALLOW_AUTODIFF |
6 |
# include "AUTODIFF_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
CBOP |
10 |
C !ROUTINE: SEAICE_DIFFUSION |
11 |
C !INTERFACE: |
12 |
SUBROUTINE SEAICE_DIFFUSION( |
13 |
I tracerIdentity, |
14 |
I diffKh, fac, |
15 |
I iceFld, iceMask, xA, yA, |
16 |
U gFld, |
17 |
I bi, bj, myTime, myIter, myThid ) |
18 |
|
19 |
C !DESCRIPTION: \bv |
20 |
C *==========================================================* |
21 |
C | SUBROUTINE SEAICE_DIFFUSION |
22 |
C | o Add tendency from horizontal diffusion |
23 |
C *==========================================================* |
24 |
C *==========================================================* |
25 |
|
26 |
C !USES: |
27 |
IMPLICIT NONE |
28 |
|
29 |
C === Global variables === |
30 |
#include "SIZE.h" |
31 |
#include "EEPARAMS.h" |
32 |
#include "PARAMS.h" |
33 |
#include "GRID.h" |
34 |
#include "SEAICE_SIZE.h" |
35 |
#include "SEAICE_PARAMS.h" |
36 |
CML#include "SEAICE_GRID.h" |
37 |
|
38 |
#ifdef ALLOW_AUTODIFF_TAMC |
39 |
# include "tamc.h" |
40 |
#endif |
41 |
|
42 |
C !INPUT PARAMETERS: |
43 |
C === Routine arguments === |
44 |
C afx :: horizontal advective flux, x direction |
45 |
C afy :: horizontal advective flux, y direction |
46 |
C myThid :: my Thread Id number |
47 |
_RL iceFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
48 |
_RL gFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
49 |
_RL iceMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
50 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
51 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
52 |
_RL diffKh, fac |
53 |
INTEGER tracerIdentity |
54 |
INTEGER bi,bj |
55 |
_RL myTime |
56 |
INTEGER myIter |
57 |
INTEGER myThid |
58 |
#ifdef ALLOW_DIAGNOSTICS |
59 |
CHARACTER*8 diagName |
60 |
CHARACTER*4 SEAICE_DIAG_SUFX, diagSufx |
61 |
EXTERNAL SEAICE_DIAG_SUFX |
62 |
#endif |
63 |
CEOP |
64 |
|
65 |
C !LOCAL VARIABLES: |
66 |
C === Local variables === |
67 |
C i,j :: Loop counters |
68 |
INTEGER i, j, k |
69 |
_RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
70 |
_RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
71 |
|
72 |
IF ( diffKh .GT. 0. _d 0 ) THEN |
73 |
#ifdef ALLOW_DIAGNOSTICS |
74 |
C-- Set diagnostic suffix for the current tracer |
75 |
IF ( useDiagnostics ) THEN |
76 |
diagSufx = SEAICE_DIAG_SUFX( tracerIdentity, myThid ) |
77 |
ENDIF |
78 |
#endif |
79 |
C-- Tendency due to horizontal diffusion |
80 |
k = 1 |
81 |
DO j=1-Oly,sNy+Oly |
82 |
DO i=1-Olx,sNx+Olx |
83 |
fZon (i,j) = 0. _d 0 |
84 |
fMer (i,j) = 0. _d 0 |
85 |
ENDDO |
86 |
ENDDO |
87 |
C-- X-direction |
88 |
CALL GAD_DIFF_X(bi,bj,k,xA,diffKh,iceFld,fZon,myThid) |
89 |
C-- Y-direction |
90 |
CALL GAD_DIFF_Y(bi,bj,k,yA,diffKh,iceFld,fMer,myThid) |
91 |
C-- Divergence of fluxes: update scalar field |
92 |
DO j=1-Oly,sNy+Oly-1 |
93 |
DO i=1-Olx,sNx+Olx-1 |
94 |
gFld(i,j)= gFld(i,j) |
95 |
& - fac*iceMask(i,j,bi,bj)*recip_rA(i,j,bi,bj) |
96 |
& *( (fZon(i+1,j)-fZon(i,j)) |
97 |
& + (fMer(i,j+1)-fMer(i,j)) ) |
98 |
ENDDO |
99 |
ENDDO |
100 |
#ifdef ALLOW_DIAGNOSTICS |
101 |
C- Diagnostics of Tracer flux in Y dir (mainly Diffusive terms), |
102 |
C excluding advective terms: |
103 |
IF ( useDiagnostics .AND. diffKh.NE.0. ) THEN |
104 |
diagName = 'DFxE'//diagSufx |
105 |
CALL DIAGNOSTICS_FILL(fZon,diagName, k,1, 2,bi,bj, myThid) |
106 |
diagName = 'DFyE'//diagSufx |
107 |
CALL DIAGNOSTICS_FILL(fMer,diagName, k,1, 2,bi,bj, myThid) |
108 |
ENDIF |
109 |
#endif |
110 |
C endif do horizontal diffusion |
111 |
ENDIF |
112 |
|
113 |
RETURN |
114 |
END |