1 |
C $Header: $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "SEAICE_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: SEAICE_DIFFUSION |
8 |
C !INTERFACE: |
9 |
SUBROUTINE SEAICE_DIFFUSION( |
10 |
I tracerIdentity, |
11 |
I iceFld, iceMask, xA, yA, |
12 |
U gFld, |
13 |
I bi, bj, myTime, myIter, myThid ) |
14 |
|
15 |
C !DESCRIPTION: \bv |
16 |
C *==========================================================* |
17 |
C | SUBROUTINE SEAICE_DIFFUSION |
18 |
C | o Add tendency from horizontal diffusion |
19 |
C *==========================================================* |
20 |
C *==========================================================* |
21 |
|
22 |
C !USES: |
23 |
IMPLICIT NONE |
24 |
|
25 |
C === Global variables === |
26 |
#include "SIZE.h" |
27 |
#include "EEPARAMS.h" |
28 |
#include "PARAMS.h" |
29 |
#include "GRID.h" |
30 |
#include "SEAICE_PARAMS.h" |
31 |
CML#include "SEAICE_GRID.h" |
32 |
|
33 |
#ifdef ALLOW_AUTODIFF_TAMC |
34 |
# include "tamc.h" |
35 |
#endif |
36 |
|
37 |
C !INPUT PARAMETERS: |
38 |
C === Routine arguments === |
39 |
C afx :: horizontal advective flux, x direction |
40 |
C afy :: horizontal advective flux, y direction |
41 |
C myThid :: my Thread Id number |
42 |
_RL iceFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
43 |
_RL gFld (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
44 |
_RL iceMask(1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
45 |
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
46 |
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
47 |
INTEGER advScheme |
48 |
INTEGER tracerIdentity |
49 |
INTEGER bi,bj |
50 |
_RL myTime |
51 |
INTEGER myIter |
52 |
INTEGER myThid |
53 |
CEOP |
54 |
|
55 |
C !LOCAL VARIABLES: |
56 |
C === Local variables === |
57 |
C i,j :: Loop counters |
58 |
INTEGER i, j, k |
59 |
_RL fZon (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
60 |
_RL fMer (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
61 |
|
62 |
IF ( diff1 .GT. 0. _d 0 ) THEN |
63 |
C-- Tendency due to horizontal diffusion |
64 |
k = 1 |
65 |
DO j=1-Oly,sNy+Oly |
66 |
DO i=1-Olx,sNx+Olx |
67 |
fZon (i,j) = 0. _d 0 |
68 |
fMer (i,j) = 0. _d 0 |
69 |
ENDDO |
70 |
ENDDO |
71 |
C-- X-direction |
72 |
CALL GAD_DIFF_X(bi,bj,k,xA,diff1,iceFld,fZon,myThid) |
73 |
C-- Y-direction |
74 |
CALL GAD_DIFF_Y(bi,bj,k,yA,diff1,iceFld,fMer,myThid) |
75 |
C-- Divergence of fluxes: update scalar field |
76 |
C-- Ugly: |
77 |
C-- Apply factor min(DX,DY) to effectively end up with approximately |
78 |
C-- the same diffusion coefficient as in subroutine ADVECT. |
79 |
C-- One day, I would like to rewrite the second order central difference |
80 |
C-- part, too, so that the value of DIFF1 has the same meaning as, |
81 |
C-- say, diffKhT |
82 |
DO j=1-Oly,sNy+Oly-1 |
83 |
DO i=1-Olx,sNx+Olx-1 |
84 |
gFld(i,j)= gFld(i,j) |
85 |
& - iceMask(i,j,bi,bj)*recip_rA(i,j,bi,bj) |
86 |
& *( (fZon(i+1,j)-fZon(i,j)) |
87 |
& + (fMer(i,j+1)-fMer(i,j)) ) |
88 |
& *MIN( _dxF(I,J,bi,bj), _dyF(I,J,bi,bj)) |
89 |
ENDDO |
90 |
ENDDO |
91 |
C endif do horizontal diffusion |
92 |
ENDIF |
93 |
|
94 |
RETURN |
95 |
END |