/[MITgcm]/MITgcm/pkg/fizhi/fizhi_init_vars.F
ViewVC logotype

Annotation of /MITgcm/pkg/fizhi/fizhi_init_vars.F

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


Revision 1.19 - (hide annotations) (download)
Sun Jun 18 00:14:28 2006 UTC (18 years ago) by molod
Branch: MAIN
CVS Tags: checkpoint58l_post, checkpoint58k_post, checkpoint58m_post
Changes since 1.18: +2 -2 lines
Change interp of theta near top - make it linear in T

1 molod 1.19 C $Header: /u/gcmpack/MITgcm/pkg/fizhi/fizhi_init_vars.F,v 1.18 2005/05/04 22:15:17 molod Exp $
2 molod 1.1 C $Name: $
3    
4 molod 1.5 #include "FIZHI_OPTIONS.h"
5 molod 1.1 subroutine fizhi_init_vars (myThid)
6     c-----------------------------------------------------------------------
7     c Routine to initialise the fizhi state.
8     c
9     c Input: myThid - Process number calling this routine
10     c
11     c Notes:
12     c 1) For a Cold Start -
13     c This routine takes the initial condition on the dynamics grid
14     c and interpolates to the physics grid to initialize the state
15     c variables that are on both grids. It initializes the variables
16     c of the turbulence scheme to 0., and the land state from a model
17     c climatology.
18     c 2) For a Restart, read the fizhi pickup file
19     c 3) The velocity component physics fields are on an A-Grid
20     c
21     c Calls: dyn2phys (x4)
22     c-----------------------------------------------------------------------
23     implicit none
24     #include "SIZE.h"
25     #include "fizhi_SIZE.h"
26 molod 1.2 #include "fizhi_land_SIZE.h"
27 molod 1.1 #include "GRID.h"
28     #include "DYNVARS.h"
29     #include "gridalt_mapping.h"
30     #include "fizhi_coms.h"
31 molod 1.2 #include "fizhi_land_coms.h"
32 molod 1.4 #include "fizhi_earth_coms.h"
33 molod 1.1 #include "EEPARAMS.h"
34     #include "SURFACE.h"
35     #include "PARAMS.h"
36 molod 1.11 #include "chronos.h"
37 molod 1.1
38     integer myThid
39    
40     c pe on dynamics and physics grid refers to bottom edge
41     _RL pephy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys+1,nSx,nSy)
42     _RL pedyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr+1,nSx,nSy)
43     _RL windphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
44     _RL udyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
45     _RL vdyntemp(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy)
46 molod 1.3 _RL tempphy(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
47 molod 1.1
48     integer i, j, L, bi, bj, Lbotij
49     integer im1, im2, jm1, jm2, idim1, idim2, jdim1, jdim2
50 molod 1.15 logical alarm
51     external alarm
52 molod 1.1
53     im1 = 1-OLx
54     im2 = sNx+OLx
55     jm1 = 1-OLy
56     jm2 = sNy+OLy
57     idim1 = 1
58     idim2 = sNx
59     jdim1 = 1
60     jdim2 = sNy
61    
62 molod 1.15 c First Check to see if we can start a fizhi experiment at current time
63     c All Fizhi alarms must be on for the first time step of a segment
64 molod 1.14
65 molod 1.16 if( .not.alarm('moist') .or. .not.alarm('turb') .or.
66 molod 1.14 . .not.alarm('radsw') .or. .not.alarm('radlw') ) then
67 molod 1.16 print *,' Cant Start Fizhi experiment at ',nymd,' ',nhms
68     stop
69     endif
70 molod 1.14
71 molod 1.12 C Deal Here with Variables that are on a Fizhi Pickup or need Initialization
72    
73 jmc 1.17 IF ( startTime.EQ.baseTime .AND. nIter0.EQ.0 ) THEN
74 molod 1.11 print *,' In fizhi_init_vars: Beginning of New Experiment '
75 molod 1.1
76     do bj = myByLo(myThid), myByHi(myThid)
77     do bi = myBxLo(myThid), myBxHi(myThid)
78    
79     C Build pressures on dynamics grid
80     do j = 1,sNy
81     do i = 1,sNx
82     do L = 1,Nr
83     pedyn(i,j,L,bi,bj) = 0.
84     enddo
85     enddo
86     enddo
87     do j = 1,sNy
88     do i = 1,sNx
89     Lbotij = ksurfC(i,j,bi,bj)
90     if(Lbotij.ne.0.)
91     . pedyn(i,j,Lbotij,bi,bj) = Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj)
92     enddo
93     enddo
94     do j = 1,sNy
95     do i = 1,sNx
96     Lbotij = ksurfC(i,j,bi,bj)
97     do L = Lbotij+1,Nr+1
98     pedyn(i,j,L,bi,bj) = pedyn(i,j,L-1,bi,bj) -
99     . drF(L-1)*hfacC(i,j,L-1,bi,bj)
100     enddo
101     c Do not use a zero field as the top edge pressure for interpolation
102     if(pedyn(i,j,Nr+1,bi,bj).lt.1.e-5)
103     . pedyn(i,j,Nr+1,bi,bj) = 1.e-5
104     enddo
105     enddo
106     C Build pressures on physics grid
107     do j = 1,sNy
108     do i = 1,sNx
109     pephy(i,j,1,bi,bj)=Ro_surf(i,j,bi,bj) + etaH(i,j,bi,bj)
110     do L = 2,Nrphys+1
111     pephy(i,j,L,bi,bj)=pephy(i,j,L-1,bi,bj)-dpphys0(i,j,L-1,bi,bj)
112     enddo
113     c Do not use a zero field as the top edge pressure for interpolation
114     if(pephy(i,j,Nrphys+1,bi,bj).lt.1.e-5)
115     . pephy(i,j,Nrphys+1,bi,bj) = 1.e-5
116     enddo
117     enddo
118     c
119     c Create an initial wind magnitude field on the physics grid -
120     c Use a log wind law with z0=1cm, u*=1 cm/sec,
121     c do units and get u = .025*ln(dP*10), with dP in pa.
122     do L = 1,Nrphys
123     do j = 1,sNy
124     do i = 1,sNx
125     windphy(i,j,L,bi,bj) = 0.025 *
126     . log((pephy(i,j,1,bi,bj)-pephy(i,j,L+1,bi,bj))*10.)
127     enddo
128     enddo
129     enddo
130    
131     enddo
132     enddo
133    
134     c Create initial fields on phys. grid - Move Dynamics u and v to A-Grid
135     call CtoA(myThid,uvel,vvel,maskW,maskS,im1,im2,jm1,jm2,Nr,
136     . Nsx,Nsy,1,sNx,1,sNy,udyntemp,vdyntemp)
137    
138     do bj = myByLo(myThid), myByHi(myThid)
139     do bi = myBxLo(myThid), myBxHi(myThid)
140    
141     c Create initial fields on phys. grid - interpolate from dyn. grid
142     call dyn2phys(udyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,
143 molod 1.3 . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy)
144     c Note: Interpolation gives bottom-up arrays (level 1 is bottom),
145     c Physics works top-down. so -> need to flip arrays
146     do L = 1,Nrphys
147     do j = 1,sNy
148     do i = 1,sNx
149     uphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
150     enddo
151     enddo
152     enddo
153 molod 1.1 call dyn2phys(vdyntemp,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,
154 molod 1.3 . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,1,tempphy)
155     do L = 1,Nrphys
156     do j = 1,sNy
157     do i = 1,sNx
158     vphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
159     enddo
160     enddo
161     enddo
162 molod 1.1 call dyn2phys(theta,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,
163 molod 1.19 . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,2,tempphy)
164 molod 1.3 do L = 1,Nrphys
165     do j = 1,sNy
166     do i = 1,sNx
167     thphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
168     enddo
169     enddo
170     enddo
171 molod 1.6
172 molod 1.1 call dyn2phys(salt,pedyn,im1,im2,jm1,jm2,Nr,Nsx,Nsy,
173 molod 1.3 . 1,sNx,1,sNy,bi,bj,windphy,pephy,ksurfC,Nrphys,nlperdyn,0,tempphy)
174     do L = 1,Nrphys
175     do j = 1,sNy
176     do i = 1,sNx
177     sphy(i,j,Nrphys+1-L,bi,bj) = tempphy(i,j,L,bi,bj)
178 molod 1.10 enddo
179     enddo
180     enddo
181    
182     c Zero out fizhi tendency arrays on the fizhi grid
183     do L = 1,Nrphys
184     do j = 1,sNy
185     do i = 1,sNx
186     duphy(i,j,L,bi,bj) = 0.
187     dvphy(i,j,L,bi,bj) = 0.
188     dthphy(i,j,L,bi,bj) = 0.
189     dsphy(i,j,L,bi,bj) = 0.
190     enddo
191     enddo
192     enddo
193    
194     c Zero out fizhi tendency arrays on the dynamics grid
195     do L = 1,Nr
196     do j = jm1,jm2
197     do i = im1,im2
198     guphy(i,j,L,bi,bj) = 0.
199     gvphy(i,j,L,bi,bj) = 0.
200     gthphy(i,j,L,bi,bj) = 0.
201     gsphy(i,j,L,bi,bj) = 0.
202 molod 1.3 enddo
203     enddo
204     enddo
205 molod 1.1
206 molod 1.18 c Initialize vegetation tile tke, xlmt, khmt, xxmt, yymt, ctmt, zetamt,
207 molod 1.11 if( (nhms.eq.nhms0) .and. (nymd.eq.nymd0) ) then
208     print *,' Cold Start: Zero out Turb second moments '
209     do i = 1,nchp
210     ctmt(i,bi,bj) = 0.
211     xxmt(i,bi,bj) = 0.
212     yymt(i,bi,bj) = 0.
213     zetamt(i,bi,bj) = 0.
214     enddo
215     do L = 1,Nrphys
216     do i = 1,nchp
217     tke(i,L,bi,bj) = 0.
218     xlmt(i,L,bi,bj) = 0.
219     khmt(i,L,bi,bj) = 0.
220     enddo
221     enddo
222 molod 1.12 else
223 molod 1.13 print *,' Need initial Values for TKE - dont have them! '
224 molod 1.12 stop
225 molod 1.11 endif
226    
227 molod 1.18 c Now initialize vegetation tile land state too - tcanopy, etc...
228     call fizhi_init_vegsurftiles( nymd,nhms, 'D', myThid )
229 molod 1.1
230 molod 1.18 c Now initialize fizhi arrays that will be on a pickup
231 molod 1.11 print *,' Initialize fizhi arrays that will be on pickup '
232     imstturblw(bi,bj) = 0
233     imstturbsw(bi,bj) = 0
234     iras(bi,bj) = 0
235     nlwcld(bi,bj) = 0
236     nlwlz(bi,bj) = 0
237     nswcld(bi,bj) = 0
238     nswlz(bi,bj) = 0
239     do L = 1,Nrphys
240     do j = 1,sNy
241     do i = 1,sNx
242 molod 1.13 swlz(i,j,L,bi,bj) = 0.
243     lwlz(i,j,L,bi,bj) = 0.
244     qliqavesw(i,j,L,bi,bj) = 0.
245     qliqavelw(i,j,L,bi,bj) = 0.
246     fccavesw(i,j,L,bi,bj) = 0.
247     fccavelw(i,j,L,bi,bj) = 0.
248     cldtot_sw(i,j,L,bi,bj) = 0.
249     cldras_sw(i,j,L,bi,bj) = 0.
250     cldlsp_sw(i,j,L,bi,bj) = 0.
251     cldtot_lw(i,j,L,bi,bj) = 0.
252     cldras_lw(i,j,L,bi,bj) = 0.
253     cldlsp_lw(i,j,L,bi,bj) = 0.
254 molod 1.11 enddo
255     enddo
256     enddo
257     do j = 1,sNy
258     do i = 1,sNx
259 molod 1.13 rainlsp(i,j,bi,bj) = 0.
260     raincon(i,j,bi,bj) = 0.
261     snowfall(i,j,bi,bj) = 0.
262 molod 1.11 enddo
263     enddo
264    
265 molod 1.1 enddo
266     enddo
267    
268     ELSE
269     print *,' In fizhi_init_vars: Read from restart '
270    
271     C-- Read fizhi package state variables from pickup file
272 molod 1.9
273 molod 1.3 call fizhi_read_pickup( nIter0, myThid )
274 edhill 1.7 CALL FIZHI_READ_VEGTILES( nIter0, 'D', myThid )
275    
276 molod 1.1 ENDIF
277    
278     return
279     end

  ViewVC Help
Powered by ViewVC 1.1.22