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