1 |
gforget |
1.10 |
C $Header: /u/gcmpack/MITgcm/pkg/seaice/seaice_diffusion.F,v 1.9 2012/11/09 22:15:18 heimbach Exp $ |
2 |
mlosch |
1.1 |
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "SEAICE_OPTIONS.h" |
5 |
gforget |
1.10 |
#ifdef ALLOW_AUTODIFF |
6 |
|
|
# include "AUTODIFF_OPTIONS.h" |
7 |
|
|
#endif |
8 |
mlosch |
1.1 |
|
9 |
jmc |
1.5 |
CBOP |
10 |
|
|
C !ROUTINE: SEAICE_DIFFUSION |
11 |
|
|
C !INTERFACE: |
12 |
|
|
SUBROUTINE SEAICE_DIFFUSION( |
13 |
|
|
I tracerIdentity, |
14 |
gforget |
1.8 |
I diffKh, fac, |
15 |
jmc |
1.5 |
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 |
mlosch |
1.1 |
IMPLICIT NONE |
28 |
|
|
|
29 |
|
|
C === Global variables === |
30 |
|
|
#include "SIZE.h" |
31 |
|
|
#include "EEPARAMS.h" |
32 |
|
|
#include "PARAMS.h" |
33 |
|
|
#include "GRID.h" |
34 |
heimbach |
1.9 |
#include "SEAICE_SIZE.h" |
35 |
mlosch |
1.1 |
#include "SEAICE_PARAMS.h" |
36 |
|
|
CML#include "SEAICE_GRID.h" |
37 |
|
|
|
38 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
39 |
|
|
# include "tamc.h" |
40 |
|
|
#endif |
41 |
|
|
|
42 |
jmc |
1.5 |
C !INPUT PARAMETERS: |
43 |
mlosch |
1.1 |
C === Routine arguments === |
44 |
jmc |
1.5 |
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 |
gforget |
1.8 |
_RL diffKh, fac |
53 |
jmc |
1.5 |
INTEGER tracerIdentity |
54 |
|
|
INTEGER bi,bj |
55 |
mlosch |
1.1 |
_RL myTime |
56 |
|
|
INTEGER myIter |
57 |
|
|
INTEGER myThid |
58 |
mlosch |
1.6 |
#ifdef ALLOW_DIAGNOSTICS |
59 |
|
|
CHARACTER*8 diagName |
60 |
|
|
CHARACTER*4 SEAICE_DIAG_SUFX, diagSufx |
61 |
|
|
EXTERNAL SEAICE_DIAG_SUFX |
62 |
|
|
#endif |
63 |
jmc |
1.5 |
CEOP |
64 |
mlosch |
1.1 |
|
65 |
jmc |
1.5 |
C !LOCAL VARIABLES: |
66 |
mlosch |
1.1 |
C === Local variables === |
67 |
jmc |
1.5 |
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 |
gforget |
1.8 |
IF ( diffKh .GT. 0. _d 0 ) THEN |
73 |
mlosch |
1.6 |
#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 |
jmc |
1.5 |
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 |
mlosch |
1.1 |
ENDDO |
86 |
|
|
ENDDO |
87 |
jmc |
1.5 |
C-- X-direction |
88 |
gforget |
1.8 |
CALL GAD_DIFF_X(bi,bj,k,xA,diffKh,iceFld,fZon,myThid) |
89 |
jmc |
1.5 |
C-- Y-direction |
90 |
gforget |
1.8 |
CALL GAD_DIFF_Y(bi,bj,k,yA,diffKh,iceFld,fMer,myThid) |
91 |
jmc |
1.5 |
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 |
gforget |
1.8 |
& - fac*iceMask(i,j,bi,bj)*recip_rA(i,j,bi,bj) |
96 |
jmc |
1.5 |
& *( (fZon(i+1,j)-fZon(i,j)) |
97 |
|
|
& + (fMer(i,j+1)-fMer(i,j)) ) |
98 |
mlosch |
1.1 |
ENDDO |
99 |
|
|
ENDDO |
100 |
mlosch |
1.6 |
#ifdef ALLOW_DIAGNOSTICS |
101 |
|
|
C- Diagnostics of Tracer flux in Y dir (mainly Diffusive terms), |
102 |
|
|
C excluding advective terms: |
103 |
gforget |
1.8 |
IF ( useDiagnostics .AND. diffKh.NE.0. ) THEN |
104 |
mlosch |
1.6 |
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 |
jmc |
1.5 |
C endif do horizontal diffusion |
111 |
|
|
ENDIF |
112 |
mlosch |
1.1 |
|
113 |
|
|
RETURN |
114 |
|
|
END |