1 |
C $Header: /u/gcmpack/MITgcm/pkg/gchem/gchem_add_tendency.F,v 1.5 2014/07/09 16:56:08 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "GCHEM_OPTIONS.h" |
5 |
|
6 |
CBOP |
7 |
C !ROUTINE: GCHEM_ADD_TENDENCY |
8 |
|
9 |
C !INTERFACE: ========================================================== |
10 |
SUBROUTINE GCHEM_ADD_TENDENCY( |
11 |
U gPtracer, |
12 |
I iMin,iMax,jMin,jMax, k, bi, bj, |
13 |
I iTr, myTime, myIter, myThid ) |
14 |
|
15 |
C !DESCRIPTION: |
16 |
C In the case of a tracer not using GCHEM_SEPARATE_FORCING, |
17 |
C GCHEM_ADD_TENDENCY will update passive tracer tendencies gPtr with |
18 |
C gchemTendency, the latter having been computed in GCHEM_CALC_TENDENDY, |
19 |
C so that they will be incorporated into regular timestepping in |
20 |
C PTRACERS_INTERGRATE. |
21 |
|
22 |
C !USES: =============================================================== |
23 |
IMPLICIT NONE |
24 |
#include "SIZE.h" |
25 |
#include "EEPARAMS.h" |
26 |
#include "PARAMS.h" |
27 |
#include "GCHEM.h" |
28 |
#include "GCHEM_SIZE.h" |
29 |
#include "GCHEM_FIELDS.h" |
30 |
|
31 |
C !INPUT/OUTPUT PARAMETERS: ============================================ |
32 |
C gPtracer :: the tendency array |
33 |
C k :: vertical level |
34 |
C bi,bj :: tile indices |
35 |
C iTr :: ptracer number |
36 |
C myTime :: current time |
37 |
C myIter :: current timestep |
38 |
C myThid :: thread number |
39 |
_RL gPtracer (1-OLx:sNx+OLx,1-OLy:sNy+OLy) |
40 |
INTEGER iMin,iMax,jMin,jMax |
41 |
INTEGER k, bi, bj, iTr |
42 |
_RL myTime |
43 |
INTEGER myIter, myThid |
44 |
CEOP |
45 |
|
46 |
#ifdef GCHEM_ADD2TR_TENDENCY |
47 |
C !LOCAL VARIABLES: ==================================================== |
48 |
C jTr :: number of corresponding tracer tendency (in gchemTendency) |
49 |
C i,j :: loop indices |
50 |
INTEGER jTr |
51 |
INTEGER i,j |
52 |
|
53 |
C Apply the tendencies computed in GCHEM_CALC_TENDENCY to the passive |
54 |
C tracers tendendy terms. The part of the code could also go into |
55 |
C ptracers_forcing and replace the call to gchem_add_tendency there, |
56 |
C but this way, no gchem-related header files and CPP-flags are required |
57 |
C within ptracers_forcing. |
58 |
IF ( iTr.GT.gchem_sepFTr_num .AND. |
59 |
& iTr.LE.gchem_Tracer_num ) THEN |
60 |
jTr = iTr - gchem_sepFTr_num |
61 |
DO j=jMin,jMax |
62 |
DO i=iMin,iMax |
63 |
gPtracer(i,j) = gPtracer(i,j) |
64 |
& + gchemTendency(i,j,k,bi,bj,jTr) |
65 |
ENDDO |
66 |
ENDDO |
67 |
ENDIF |
68 |
#endif /* GCHEM_ADD2TR_TENDENCY */ |
69 |
|
70 |
RETURN |
71 |
END |