1 |
C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_fixed.F,v 1.32 2009/05/06 02:57:46 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "FIZHI_OPTIONS.h" |
5 |
subroutine fizhi_init_fixed (myThid) |
6 |
c----------------------------------------------------------------------- |
7 |
c Routine to initialise the fizhi package. |
8 |
c |
9 |
c Input: myThid - Process number calling this routine |
10 |
c |
11 |
c Notes: |
12 |
c 1) This routine is the interface to read input datasets and set |
13 |
c other fixed variables for fizhi |
14 |
c the datasets are: |
15 |
c vegetation (data for each tile at every grid point) |
16 |
c ozone (varies with lat, height and time - read it all in |
17 |
c now and interpolate between values later) |
18 |
c the other fixed parameters are: |
19 |
c N2O, Methane (vary with space) |
20 |
c CO2, CFC11, CFC12, CFC22 (set to a global value) |
21 |
c 3) For now, the fizhi package contains the alarms and clocks |
22 |
c routines, so this routine will also initialize the alarms. |
23 |
c----------------------------------------------------------------------- |
24 |
implicit none |
25 |
#include "SIZE.h" |
26 |
#include "fizhi_SIZE.h" |
27 |
#include "fizhi_land_SIZE.h" |
28 |
#include "EEPARAMS.h" |
29 |
#include "fizhi_chemistry_coms.h" |
30 |
#include "fizhi_earth_coms.h" |
31 |
#include "fizhi_land_coms.h" |
32 |
#include "fizhi_ocean_coms.h" |
33 |
#include "chronos.h" |
34 |
#include "gridalt_mapping.h" |
35 |
#include "GRID.h" |
36 |
#include "PARAMS.h" |
37 |
#ifdef ALLOW_EXCH2 |
38 |
#include "W2_EXCH2_SIZE.h" |
39 |
#include "W2_EXCH2_TOPOLOGY.h" |
40 |
#endif /* ALLOW_EXCH2 */ |
41 |
|
42 |
integer myThid |
43 |
|
44 |
integer i,j,L,bi,bj |
45 |
integer im1, im2, jm1, jm2, idim2, jdim2 |
46 |
integer nymdb,nhmsb |
47 |
character*40 vegdata |
48 |
_RL pressure0(Nrphys+1) |
49 |
_RL pressure(Nrphys) |
50 |
_RL lats(sNx,sNy,Nsx,Nsy), lons(sNx,sNy,Nsx,Nsy) |
51 |
_RL fracland(sNx,sNy,Nsx,Nsy) |
52 |
_RL tempoverlap(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nsx,Nsy) |
53 |
integer xsize, ysize |
54 |
|
55 |
#if defined(ALLOW_EXCH2) |
56 |
xsize = exch2_global_Nx |
57 |
ysize = exch2_global_Ny |
58 |
#else |
59 |
xsize = Nx |
60 |
ysize = Ny |
61 |
#endif |
62 |
idim2 = sNx+OLx |
63 |
jdim2 = sNy+OLy |
64 |
im1 = 1 |
65 |
im2 = sNx |
66 |
jm1 = 1 |
67 |
jm2 = sNy |
68 |
nymdb = nymd0 |
69 |
nhmsb = nhms0 |
70 |
|
71 |
#ifdef ALLOW_MNC |
72 |
if (useMNC) then |
73 |
call fizhi_mnc_init(myThid) |
74 |
endif |
75 |
#endif |
76 |
|
77 |
#ifdef ALLOW_DIAGNOSTICS |
78 |
if ( useDiagnostics ) then |
79 |
call fizhi_diagnostics_init( myThid ) |
80 |
endif |
81 |
#endif |
82 |
|
83 |
call fizhi_alarms(nymdb,nhmsb,deltaTClock) |
84 |
|
85 |
do bj = myByLo(myThid), myByHi(myThid) |
86 |
do bi = myBxLo(myThid), myBxHi(myThid) |
87 |
do j = jm1,jm2 |
88 |
do i = im1,im2 |
89 |
lons(i,j,bi,bj) = xC(i,j,bi,bj) |
90 |
lats(i,j,bi,bj) = yC(i,j,bi,bj) |
91 |
enddo |
92 |
enddo |
93 |
enddo |
94 |
enddo |
95 |
if(xsize.eq.192) then |
96 |
vegdata = 'veg19232.data' |
97 |
elseif(xsize.eq.612) then |
98 |
vegdata = 'veg612102.data' |
99 |
else |
100 |
print *,' xsize is ',xsize |
101 |
stop 'do not seem to have correct vegetation data ' |
102 |
endif |
103 |
|
104 |
call fizhi_init_veg ( mythid, vegdata,im2,jm2,Nsx,Nsy, |
105 |
. nSx*nPx,nSy*nPy,maxtyp,nchp,nchptot,nchpland,lons,lats, |
106 |
. surftype,tilefrac,igrd,ityp,chfr,chlt,chlon) |
107 |
|
108 |
C And now fill the earth export landtype |
109 |
do bj = myByLo(myThid), myByHi(myThid) |
110 |
do bi = myBxLo(myThid), myBxHi(myThid) |
111 |
call get_landfrac(im2,jm2,Nsx,Nsy,bi,bj,maxtyp, |
112 |
. surftype,tilefrac,fracland(1,1,bi,bj)) |
113 |
do j=jm1,jm2 |
114 |
do i=im1,im2 |
115 |
landtype(i,j,bi,bj) = surftype(i,j,1,bi,bj) |
116 |
if(fracland(i,j,bi,bj).ge.0.3.and.surftype(i,j,1,bi,bj).ge.100) |
117 |
. landtype(i,j,bi,bj) = surftype(i,j,2,bi,bj) |
118 |
if(sice(i,j,bi,bj).ne.0.0)landtype(i,j,bi,bj) = 101 |
119 |
enddo |
120 |
enddo |
121 |
enddo |
122 |
enddo |
123 |
|
124 |
C Compute pressure profile to get methane and n2o values |
125 |
C - First bottom-up (in mb) |
126 |
|
127 |
pressure0(1)=1000. |
128 |
do L = 2,Nrphys+1 |
129 |
pressure0(L)=pressure0(L-1)-dpphys0(1,1,L-1,1,1)/100. |
130 |
enddo |
131 |
C Now flip pressure to a top-down array and average to mid levels |
132 |
C to send to fizhi init chem |
133 |
do L = 1,Nrphys |
134 |
pressure(L)=(pressure0(Nrphys+2-L)+pressure0(Nrphys+1-L))/2. |
135 |
enddo |
136 |
|
137 |
call fizhi_init_chem(mythid, |
138 |
. nlatsoz,nlevsoz,ntimesoz,latsoz,levsoz,ozone, |
139 |
. nlatsq,nlevsq,ntimesq,latsq,levsq,stratq, |
140 |
. Nrphys,pressure,n2o,methane,co2,cfc11,cfc12,cfc22) |
141 |
|
142 |
C Read dataset that contains topography variance (10m by 10m in a 2x2.5 box) |
143 |
if(xsize.eq.192) then |
144 |
CALL READ_REC_XY_RL('topvar19232.data',tempoverlap,1,0,mythid ) |
145 |
elseif(xsize.eq.612) then |
146 |
CALL READ_REC_XY_RL('topvar612102.data',tempoverlap,1,0,mythid ) |
147 |
else |
148 |
print *,' xsize is ',xsize |
149 |
stop 'do not seem to have correct topog variance data ' |
150 |
endif |
151 |
_BARRIER |
152 |
|
153 |
do bj = myByLo(myThid), myByHi(myThid) |
154 |
do bi = myBxLo(myThid), myBxHi(myThid) |
155 |
do j=jm1,jm2 |
156 |
do i=im1,im2 |
157 |
if(fracland(i,j,bi,bj).gt.0.3) then |
158 |
phis_var(i,j,bi,bj) = tempoverlap(i,j,bi,bj) |
159 |
else |
160 |
phis_var(i,j,bi,bj) = 0. |
161 |
endif |
162 |
enddo |
163 |
enddo |
164 |
enddo |
165 |
enddo |
166 |
|
167 |
C Finally, grab unit numbers for reading sst and sea ice |
168 |
C (held in common block fizhi ocean coms) |
169 |
|
170 |
call mdsfindunit( kice, myThid ) |
171 |
open(kice) |
172 |
call mdsfindunit( ksst, myThid ) |
173 |
open(ksst) |
174 |
|
175 |
return |
176 |
end |