1 |
dimitri |
1.1 |
C $Header: /usr/local/gcmpack/MITgcm_contrib/ocean_inversion_project/code/ptracers_forcing.F,v 1.2 2003/09/23 04:34:23 dimitri Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
#include "PTRACERS_OPTIONS.h" |
5 |
|
|
|
6 |
|
|
CBOP |
7 |
|
|
C !ROUTINE: PTRACERS_FORCING |
8 |
|
|
|
9 |
|
|
C !INTERFACE: ========================================================== |
10 |
|
|
SUBROUTINE PTRACERS_FORCING( |
11 |
|
|
I bi,bj,k,iTracer, |
12 |
|
|
U gPtracer, |
13 |
|
|
I myIter,myTime,myThid ) |
14 |
|
|
|
15 |
|
|
C !DESCRIPTION: |
16 |
|
|
C Adds sources and sinks of passive tracers to the tendency arrays |
17 |
|
|
C This file is customized to compute CO2 perturbations from |
18 |
|
|
C 30 ocean regions for Gruber's ocean inversion project. |
19 |
|
|
|
20 |
|
|
C !USES: =============================================================== |
21 |
|
|
IMPLICIT NONE |
22 |
|
|
#include "SIZE.h" |
23 |
|
|
#include "EEPARAMS.h" |
24 |
|
|
#include "PTRACERS.h" |
25 |
|
|
#include "PARAMS.h" |
26 |
|
|
#include "FFIELDS.h" |
27 |
|
|
#include "DYNVARS.h" |
28 |
|
|
#include "GRID.h" |
29 |
|
|
|
30 |
|
|
C !INPUT PARAMETERS: =================================================== |
31 |
|
|
C bi,bj :: tile indices |
32 |
|
|
C k :: vertical level number |
33 |
|
|
C iTracer :: passive tracer index |
34 |
|
|
C gPtracer :: the tendancy array |
35 |
|
|
C myIter :: time-step number |
36 |
|
|
C myTime :: model time |
37 |
|
|
C myThid :: thread number |
38 |
|
|
INTEGER bi,bj,k,iTracer |
39 |
|
|
_RL gPtracer(1-Olx:sNx+Olx,1-Oly:sNy+Oly,Nr,nSx,nSy) |
40 |
|
|
INTEGER myIter |
41 |
|
|
_RL myTime |
42 |
|
|
INTEGER myThid |
43 |
|
|
|
44 |
|
|
C !OUTPUT PARAMETERS: ================================================== |
45 |
|
|
C gPtracer :: updates tendancy array |
46 |
|
|
|
47 |
|
|
#ifdef ALLOW_PTRACERS |
48 |
|
|
|
49 |
|
|
C !LOCAL VARIABLES: ==================================================== |
50 |
|
|
C i,j :: loop indices |
51 |
|
|
INTEGER i,j |
52 |
|
|
integer fldstartdate(4), mydate(4), difftime(4) |
53 |
|
|
integer count0, count1 |
54 |
|
|
_RL repeatPeriod, fldperiod, fac, fldsecs, fldsecs0, fldsecs1 |
55 |
|
|
|
56 |
|
|
CEOP |
57 |
|
|
|
58 |
|
|
C Compute time interpolation indices and factors. |
59 |
|
|
C It is assumed that each year is 365.25 days (31557600 s) |
60 |
|
|
C long and that each month is 2629800 s. |
61 |
|
|
repeatPeriod = 31557600 |
62 |
|
|
fldperiod = 2629800 |
63 |
|
|
|
64 |
|
|
C fldstartdate is January 15, 1765, 5:15am |
65 |
|
|
fldstartdate(1) = 17650115 |
66 |
|
|
fldstartdate(2) = 51500 |
67 |
|
|
fldstartdate(3) = 1 |
68 |
|
|
fldstartdate(4) = 5 |
69 |
|
|
|
70 |
|
|
C Determine offset in seconds from beginning of input data |
71 |
|
|
C to current date. |
72 |
|
|
call cal_GetDate( myiter, mytime, mydate, mythid ) |
73 |
|
|
call cal_TimePassed( fldstartdate, mydate, difftime, mythid ) |
74 |
|
|
call cal_ToSeconds( difftime, fldsecs, mythid ) |
75 |
|
|
|
76 |
|
|
C Determine the flux records just before and after mycurrentdate. |
77 |
|
|
do while ( fldsecs .lt. 0 ) |
78 |
|
|
fldsecs = fldsecs + repeatPeriod |
79 |
|
|
enddo |
80 |
|
|
fldsecs0 = mod(fldsecs,repeatPeriod) |
81 |
|
|
count0 = int((fldsecs0+0.5)/fldperiod) + 1 |
82 |
|
|
fldsecs1 = mod(fldsecs+fldperiod,repeatPeriod) |
83 |
|
|
count1 = int((fldsecs1+0.5)/fldperiod) + 1 |
84 |
|
|
fldsecs = fldsecs0-int((fldsecs0+0.5)/fldperiod)*fldperiod |
85 |
|
|
|
86 |
|
|
C Weight belonging to irec for linear interpolation purposes. |
87 |
|
|
C Note: The weight as chosen here is 1. - fac of the "old" |
88 |
|
|
C MITgcm's estimation program. |
89 |
|
|
fac = 1. - fldsecs/fldperiod |
90 |
|
|
|
91 |
|
|
IF (k.EQ.1) THEN |
92 |
|
|
DO j=1-Oly,sNy+Oly |
93 |
|
|
DO i=1-Olx,sNx+Olx |
94 |
|
|
surfaceTendencyPtr(i,j,k,bi,bj,iTracer) = |
95 |
|
|
& pTracerMasks(i,j,iTracer,bi,bj) * ( |
96 |
|
|
& pTracerTakahashi(I,J,count0,bi,bj) * fac + |
97 |
|
|
& pTracerTakahashi(I,J,count1,bi,bj) * (1-fac) ) * |
98 |
|
|
& recip_drF(1) * recip_hFacC(i,j,1,bi,bj) |
99 |
|
|
gPtracer(i,j,k,bi,bj) = gPtracer(i,j,k,bi,bj) + |
100 |
|
|
& surfaceTendencyPtr(i,j,k,bi,bj,iTracer) |
101 |
|
|
ENDDO |
102 |
|
|
ENDDO |
103 |
|
|
ENDIF |
104 |
|
|
|
105 |
|
|
#endif /* ALLOW_PTRACERS */ |
106 |
|
|
|
107 |
|
|
RETURN |
108 |
|
|
END |