1 |
jmc |
1.4 |
C $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/aim.5l_LatLon/code/Attic/calc_gs.F,v 1.4 2001/09/27 15:36:29 jmc Exp $ |
2 |
adcroft |
1.3 |
C $Name: $ |
3 |
adcroft |
1.2 |
|
4 |
|
|
#include "CPP_OPTIONS.h" |
5 |
|
|
|
6 |
jmc |
1.4 |
CBOP |
7 |
|
|
C !ROUTINE: CALC_GS |
8 |
|
|
C !INTERFACE: |
9 |
adcroft |
1.2 |
SUBROUTINE CALC_GS( |
10 |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
11 |
|
|
I xA,yA,uTrans,vTrans,rTrans,maskUp, |
12 |
|
|
I KappaRS, |
13 |
|
|
U fVerS, |
14 |
jmc |
1.4 |
I myTime,myIter,myThid ) |
15 |
|
|
C !DESCRIPTION: \bv |
16 |
|
|
C *==========================================================* |
17 |
|
|
C | SUBROUTINE CALC_GS |
18 |
|
|
C | o Calculate the salt tendency terms. |
19 |
|
|
C *==========================================================* |
20 |
|
|
C | A procedure called EXTERNAL_FORCING_S is called from |
21 |
|
|
C | here. These procedures can be used to add per problem |
22 |
|
|
C | E-P flux source terms. |
23 |
|
|
C | Note: Although it is slightly counter-intuitive the |
24 |
|
|
C | EXTERNAL_FORCING routine is not the place to put |
25 |
|
|
C | file I/O. Instead files that are required to |
26 |
|
|
C | calculate the external source terms are generally |
27 |
|
|
C | read during the model main loop. This makes the |
28 |
|
|
C | logisitics of multi-processing simpler and also |
29 |
|
|
C | makes the adjoint generation simpler. It also |
30 |
|
|
C | allows for I/O to overlap computation where that |
31 |
|
|
C | is supported by hardware. |
32 |
|
|
C | Aside from the problem specific term the code here |
33 |
|
|
C | forms the tendency terms due to advection and mixing |
34 |
|
|
C | The baseline implementation here uses a centered |
35 |
|
|
C | difference form for the advection term and a tensorial |
36 |
|
|
C | divergence of a flux form for the diffusive term. The |
37 |
|
|
C | diffusive term is formulated so that isopycnal mixing and |
38 |
|
|
C | GM-style subgrid-scale terms can be incorporated b simply |
39 |
|
|
C | setting the diffusion tensor terms appropriately. |
40 |
|
|
C *==========================================================* |
41 |
|
|
C \ev |
42 |
|
|
|
43 |
|
|
C !USES: |
44 |
adcroft |
1.2 |
IMPLICIT NONE |
45 |
|
|
C == GLobal variables == |
46 |
|
|
#include "SIZE.h" |
47 |
|
|
#include "DYNVARS.h" |
48 |
|
|
#include "EEPARAMS.h" |
49 |
|
|
#include "PARAMS.h" |
50 |
adcroft |
1.3 |
#include "GAD.h" |
51 |
adcroft |
1.2 |
|
52 |
jmc |
1.4 |
C !INPUT/OUTPUT PARAMETERS: |
53 |
adcroft |
1.2 |
C == Routine arguments == |
54 |
jmc |
1.4 |
C fVerS :: Flux of salt (S) in the vertical |
55 |
adcroft |
1.2 |
C direction at the upper(U) and lower(D) faces of a cell. |
56 |
jmc |
1.4 |
C maskUp :: Land mask used to denote base of the domain. |
57 |
|
|
C xA :: Tracer cell face area normal to X |
58 |
|
|
C yA :: Tracer cell face area normal to X |
59 |
|
|
C uTrans :: Zonal volume transport through cell face |
60 |
|
|
C vTrans :: Meridional volume transport through cell face |
61 |
|
|
C rTrans :: Vertical volume transport through cell face |
62 |
|
|
C bi, bj, iMin, iMax, jMin, jMax :: Range of points for which calculation |
63 |
adcroft |
1.2 |
C results will be set. |
64 |
jmc |
1.4 |
C myThid :: Instance number for this innvocation of CALC_GT |
65 |
adcroft |
1.2 |
_RL fVerS (1-OLx:sNx+OLx,1-OLy:sNy+OLy,2) |
66 |
|
|
_RS xA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
67 |
|
|
_RS yA (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
68 |
|
|
_RL uTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
69 |
|
|
_RL vTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
70 |
|
|
_RL rTrans(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
71 |
|
|
_RS maskUp(1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
72 |
|
|
_RL KappaRS(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr) |
73 |
|
|
INTEGER k,kUp,kDown,kM1 |
74 |
|
|
INTEGER bi,bj,iMin,iMax,jMin,jMax |
75 |
jmc |
1.4 |
_RL myTime |
76 |
adcroft |
1.3 |
INTEGER myIter |
77 |
adcroft |
1.2 |
INTEGER myThid |
78 |
|
|
|
79 |
jmc |
1.4 |
CEOP |
80 |
adcroft |
1.2 |
|
81 |
|
|
#ifdef ALLOW_AUTODIFF_TAMC |
82 |
|
|
C-- only the kUp part of fverS is set in this subroutine |
83 |
|
|
C-- the kDown is still required |
84 |
|
|
fVerS(1,1,kDown) = fVerS(1,1,kDown) |
85 |
|
|
#endif |
86 |
|
|
|
87 |
jmc |
1.4 |
CALL GAD_CALC_RHS( |
88 |
|
|
I bi,bj,iMin,iMax,jMin,jMax,k,kM1,kUp,kDown, |
89 |
|
|
I xA,yA,uTrans,vTrans,rTrans,maskUp, |
90 |
|
|
I diffKhS, diffK4S, KappaRS, Salt, |
91 |
|
|
I GAD_SALINITY, saltAdvScheme, |
92 |
|
|
U fVerS, gS, |
93 |
|
|
I myThid ) |
94 |
adcroft |
1.2 |
|
95 |
|
|
C-- External forcing term(s) |
96 |
jmc |
1.4 |
c CALL EXTERNAL_FORCING_S( |
97 |
|
|
c I iMin,iMax,jMin,jMax,bi,bj,k, |
98 |
|
|
c I myTime,myThid) |
99 |
adcroft |
1.3 |
|
100 |
|
|
IF ( saltAdvScheme.EQ.ENUM_CENTERED_2ND |
101 |
|
|
& .OR.saltAdvScheme.EQ.ENUM_UPWIND_3RD |
102 |
|
|
& .OR.saltAdvScheme.EQ.ENUM_CENTERED_4TH ) THEN |
103 |
|
|
CALL ADAMS_BASHFORTH2( |
104 |
|
|
I bi, bj, K, |
105 |
|
|
U gS, gSnm1, |
106 |
|
|
I myIter, myThid ) |
107 |
|
|
ENDIF |
108 |
jmc |
1.4 |
|
109 |
|
|
C-- External forcing term(s) |
110 |
|
|
CALL EXTERNAL_FORCING_S( |
111 |
|
|
I iMin,iMax,jMin,jMax,bi,bj,k, |
112 |
|
|
I myTime,myThid) |
113 |
adcroft |
1.3 |
|
114 |
|
|
#ifdef NONLIN_FRSURF |
115 |
|
|
IF (nonlinFreeSurf.GT.0) THEN |
116 |
|
|
CALL FREESURF_RESCALE_G( |
117 |
|
|
I bi, bj, K, |
118 |
|
|
U gS, |
119 |
|
|
I myThid ) |
120 |
|
|
ENDIF |
121 |
|
|
#endif /* NONLIN_FRSURF */ |
122 |
adcroft |
1.2 |
|
123 |
|
|
RETURN |
124 |
|
|
END |