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