/[MITgcm]/MITgcm_contrib/ocean_inversion_project/code/ptracers_forcing_surf.F
ViewVC logotype

Contents of /MITgcm_contrib/ocean_inversion_project/code/ptracers_forcing_surf.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Thu Dec 18 06:11:14 2003 UTC (21 years, 7 months ago) by dimitri
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +5 -5 lines
bug fix to pkg/cal/cal_toseconds.F
and length-of-year change to ocean_inversion_project/*

1 C $Header: /usr/local/gcmpack/MITgcm_contrib/ocean_inversion_project/code/ptracers_forcing_surf.F,v 1.3 2003/10/21 03:25:30 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_SURF(
11 I bi, bj, iMin, iMax, jMin, jMax,
12 I myTime,myIter,myThid )
13
14 C !DESCRIPTION:
15 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 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 C myTime :: model time
34 C myIter :: time-step number
35 C myThid :: thread number
36 INTEGER bi, bj, iMin, iMax, jMin, jMax
37 _RL myTime
38 INTEGER myIter
39 INTEGER myThid
40
41 #ifdef ALLOW_PTRACERS
42
43 C !LOCAL VARIABLES: ====================================================
44 C i,j :: loop indices
45 INTEGER i, j, iTracer
46 integer fldstartdate(4), mydate(4), difftime(4)
47 integer count0, count1
48 _RL repeatPeriod, fldperiod, frac, fldsecs, fldsecs0, fldsecs1
49 #ifdef OCEAN_INVERSION_PROJECT_TIME_DEPENDENT
50 _RL AtmCO2frac
51 integer AtmCO2rec0, AtmCO2rec1
52 #endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */
53
54 CEOP
55
56 C Compute time interpolation indices and factors.
57 C It is assumed that each year is 365.24167 days (31556880 s)
58 C long and that each month is 2629740 s.
59 repeatPeriod = 31556880
60 fldperiod = 2629740
61
62 C Takahashi climatology start date is January 15, 5:15am
63 fldstartdate(1) = 17650115
64 fldstartdate(2) = 51500
65 fldstartdate(3) = 1
66 fldstartdate(4) = 5
67
68 C Determine offset in seconds from beginning of input data
69 C to current date.
70 call cal_GetDate( myiter, mytime, mydate, mythid )
71 call cal_TimePassed( fldstartdate, mydate, difftime, mythid )
72 call cal_ToSeconds( difftime, fldsecs, mythid )
73
74 C Determine the flux records just before and after mycurrentdate.
75 do while ( fldsecs .lt. 0 )
76 fldsecs = fldsecs + repeatPeriod
77 enddo
78 fldsecs0 = mod(fldsecs,repeatPeriod)
79 count0 = int((fldsecs0+0.5)/fldperiod) + 1
80 fldsecs1 = mod(fldsecs+fldperiod,repeatPeriod)
81 count1 = int((fldsecs1+0.5)/fldperiod) + 1
82 fldsecs = fldsecs0-int((fldsecs0+0.5)/fldperiod)*fldperiod
83
84 C Weight belonging to irec for linear interpolation purposes.
85 C Note: The weight as chosen here is 1. - frac of the "old"
86 C MITgcm's estimation program.
87 frac = 1. - fldsecs/fldperiod
88
89 #ifdef OCEAN_INVERSION_PROJECT_TIME_DEPENDENT
90 C Atmospheric CO2 flux start date is January 1, 1765
91 repeatPeriod = repeatPeriod / 2
92 fldstartdate(1) = 17650101
93 fldstartdate(2) = 00000
94 fldstartdate(3) = 1
95 fldstartdate(4) = 5
96 call cal_GetDate( myiter, mytime, mydate, mythid )
97 call cal_TimePassed( fldstartdate, mydate, difftime, mythid )
98 call cal_ToSeconds( difftime, fldsecs, mythid )
99 AtmCO2rec0 = int(fldsecs/repeatPeriod)+1
100 AtmCO2rec1 = int(fldsecs/repeatPeriod)+2
101 AtmCO2frac = ( fldsecs - repeatPeriod *
102 & int(fldsecs/repeatPeriod) ) / repeatPeriod
103 AtmCO2frac = (1-AtmCO2frac) * pTracerAtmCO2(AtmCO2rec0) +
104 & AtmCO2frac * pTracerAtmCO2(AtmCO2rec1) - pTracerAtmCO2(1)
105 cdb print*,'###',myiter,mytime,AtmCO2rec0,AtmCO2rec1,AtmCO2frac
106 #endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */
107
108 DO iTracer=1,PTRACERS_numInUse
109 DO j=1-Oly,sNy+Oly
110 DO i=1-Olx,sNx+Olx
111 surfaceTendencyPtr(i,j,bi,bj,iTracer) =
112 & pTracerMasks(i,j,iTracer,bi,bj) * (
113 & pTracerTakahashi(I,J,count0,bi,bj) * frac +
114 & pTracerTakahashi(I,J,count1,bi,bj) * (1-frac) ) *
115 & recip_drF(1) * recip_hFacC(i,j,1,bi,bj)
116 #ifdef OCEAN_INVERSION_PROJECT_TIME_DEPENDENT
117 & * AtmCO2frac
118 #endif /* OCEAN_INVERSION_PROJECT_TIME_DEPENDENT */
119 ENDDO
120 ENDDO
121 ENDDO
122
123 #endif /* ALLOW_PTRACERS */
124
125 RETURN
126 END

  ViewVC Help
Powered by ViewVC 1.1.22