/[MITgcm]/MITgcm/verification/aim.5l_LatLon/code/external_fields_load.F
ViewVC logotype

Annotation of /MITgcm/verification/aim.5l_LatLon/code/external_fields_load.F

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


Revision 1.2 - (hide annotations) (download)
Tue Nov 12 20:39:46 2002 UTC (21 years, 6 months ago) by heimbach
Branch: MAIN
CVS Tags: checkpoint46n_post, checkpoint51k_post, checkpoint47j_post, checkpoint48d_pre, checkpoint51j_post, branch-exfmods-tag, checkpoint47e_post, checkpoint47i_post, checkpoint47f_post, checkpoint47c_post, checkpoint50e_post, checkpoint50c_post, checkpoint51n_pre, checkpoint47d_post, checkpoint47a_post, checkpoint48e_post, checkpoint48d_post, checkpoint50g_post, branchpoint-genmake2, checkpoint48f_post, checkpoint51o_pre, checkpoint51i_post, checkpoint48c_post, checkpoint51e_post, checkpoint51b_post, checkpoint51l_pre, checkpoint47d_pre, checkpoint47, checkpoint48, checkpoint49, checkpoint47b_post, checkpoint51l_post, checkpoint48i_post, checkpoint51o_post, checkpoint50, checkpoint51f_pre, checkpoint48h_post, checkpoint51q_post, checkpoint50d_pre, checkpoint51, checkpoint47h_post, checkpoint50d_post, checkpoint51b_pre, checkpoint47g_post, checkpoint51h_pre, checkpoint50c_pre, checkpoint50b_pre, checkpoint51g_post, checkpoint51f_post, checkpoint48b_post, checkpoint50b_post, checkpoint51c_post, checkpoint50f_post, checkpoint50a_post, checkpoint50f_pre, checkpoint51d_post, checkpoint48c_pre, checkpoint51a_post, checkpoint50e_pre, checkpoint50i_post, checkpoint51p_post, checkpoint51n_post, checkpoint48g_post, checkpoint51i_pre, checkpoint48a_post, checkpoint51m_post
Branch point for: branch-genmake2, branch-exfmods-curt, tg2-branch, checkpoint51n_branch
Changes since 1.1: +18 -34 lines
Merging from release1_p8 branch:
o external_fields_load:
  - added this routine to TAF list
  - needed to make some common blocks global and additional storing
    along the same lines as exf package (checkpoint_lev?_directives.h)

1 heimbach 1.2 C $Header: /u/gcmpack/MITgcm/verification/aim.5l_LatLon/code/external_fields_load.F,v 1.1 2001/06/18 17:39:59 cnh Exp $
2 cnh 1.1 C $Name: $
3    
4     #include "CPP_OPTIONS.h"
5    
6     CStartOfInterface
7     SUBROUTINE EXTERNAL_FIELDS_LOAD( myTime, myIter, myThid )
8     C /==========================================================\
9     C | SUBROUTINE EXTERNAL_FIELDS_LOAD |
10     C | o Control reading of fields from external source. |
11     C |==========================================================|
12     C | External source field loading routine. |
13     C | This routine is called every time we want to |
14     C | load a a set of external fields. The routine decides |
15     C | which fields to load and then reads them in. |
16     C | This routine needs to be customised for particular |
17     C | experiments. |
18     C | Notes |
19     C | ===== |
20     C | Two-dimensional and three-dimensional I/O are handled in |
21     C | the following way under MITgcmUV. A master thread |
22     C | performs I/O using system calls. This threads reads data |
23     C | into a temporary buffer. At present the buffer is loaded |
24     C | with the entire model domain. This is probably OK for now|
25     C | Each thread then copies data from the buffer to the |
26     C | region of the proper array it is responsible for. |
27     C | ===== |
28     C | Conversion of flux fields are described in FFIELDS.h |
29     C \==========================================================/
30     IMPLICIT NONE
31    
32     C === Global variables ===
33     #include "SIZE.h"
34     #include "EEPARAMS.h"
35     #include "PARAMS.h"
36     #include "FFIELDS.h"
37     #include "GRID.h"
38     #include "DYNVARS.h"
39    
40     C === Routine arguments ===
41     C myThid - Thread no. that called this routine.
42     C myTime - Simulation time
43     C myIter - Simulation timestep number
44     INTEGER myThid
45     _RL myTime
46     INTEGER myIter
47     CEndOfInterface
48    
49     C === Functions ===
50     LOGICAL DIFFERENT_MULTIPLE
51     EXTERNAL DIFFERENT_MULTIPLE
52    
53     C === Local arrays ===
54    
55     C === Local variables ===
56     INTEGER bi,bj,i,j,intime0,intime1
57    
58     _RL aWght,bWght,rdt
59     INTEGER nForcingPeriods,Imytm,Ifprd,Ifcyc,Iftm
60    
61     IF ( periodicExternalForcing ) THEN
62    
63     C First call requires that we initialize everything to zero for safety
64 heimbach 1.2 cph Transfered to ini_forcing
65     cph IF ( myIter .EQ. nIter0 ) THEN
66     cph CALL LEF_ZERO( taux0 ,myThid )
67     cph CALL LEF_ZERO( tauy0 ,myThid )
68     cph CALL LEF_ZERO( Qnet0 ,myThid )
69     cph CALL LEF_ZERO( EmPmR0 ,myThid )
70     cph CALL LEF_ZERO( SST0 ,myThid )
71     cph CALL LEF_ZERO( SSS0 ,myThid )
72     cph CALL LEF_ZERO( Qsw0 ,myThid )
73     cph CALL LEF_ZERO( taux1 ,myThid )
74     cph CALL LEF_ZERO( tauy1 ,myThid )
75     cph CALL LEF_ZERO( Qnet1 ,myThid )
76     cph CALL LEF_ZERO( EmPmR1 ,myThid )
77     cph CALL LEF_ZERO( SST1 ,myThid )
78     cph CALL LEF_ZERO( SSS1 ,myThid )
79     cph CALL LEF_ZERO( Qsw1 ,myThid )
80     cph ENDIF
81 cnh 1.1
82     C Now calculate whether it is time to update the forcing arrays
83     rdt=1. _d 0 / deltaTclock
84     nForcingPeriods=int(externForcingCycle/externForcingPeriod+0.5)
85     Imytm=int(myTime*rdt+0.5)
86     Ifprd=int(externForcingPeriod*rdt+0.5)
87     Ifcyc=int(externForcingCycle*rdt+0.5)
88     Iftm=mod( Imytm+Ifcyc-Ifprd/2 ,Ifcyc)
89    
90     intime0=int(Iftm/Ifprd)
91     intime1=mod(intime0+1,nForcingPeriods)
92     aWght=float( Iftm-Ifprd*intime0 )/float( Ifprd )
93     bWght=1.-aWght
94    
95     intime0=intime0+1
96     intime1=intime1+1
97    
98     IF (
99     & Iftm-Ifprd*(intime0-1) .EQ. 0
100     & .OR. myIter .EQ. nIter0
101     & ) THEN
102    
103     _BEGIN_MASTER(myThid)
104    
105     C If the above condition is met then we need to read in
106     C data for the period ahead and the period behind myTime.
107     write(0,*)
108     & 'S/R LOAD_INTERPOLATE_FORCING: Reading new data',myTime,myIter
109    
110     IF ( zonalWindFile .NE. ' ' ) THEN
111     CALL READ_REC_XY_RS( zonalWindFile,taux0,intime0,myIter,myThid )
112     CALL READ_REC_XY_RS( zonalWindFile,taux1,intime1,myIter,myThid )
113     ENDIF
114     IF ( meridWindFile .NE. ' ' ) THEN
115     CALL READ_REC_XY_RS( meridWindFile,tauy0,intime0,myIter,myThid )
116     CALL READ_REC_XY_RS( meridWindFile,tauy1,intime1,myIter,myThid )
117     ENDIF
118     IF ( surfQFile .NE. ' ' ) THEN
119     CALL READ_REC_XY_RS( surfQFile,Qnet0,intime0,myIter,myThid )
120     CALL READ_REC_XY_RS( surfQFile,Qnet1,intime1,myIter,myThid )
121     ENDIF
122     IF ( EmPmRfile .NE. ' ' ) THEN
123     Cfixed CALL READ_REC_XY_RS( EmPmRfile,EmPmR0,intime0,myIter,myThid )
124     Cfixed CALL READ_REC_XY_RS( EmPmRfile,EmPmR1,intime1,myIter,myThid )
125     CALL READ_REC_XY_RS( EmPmRfile,EmPmR0,1,myIter,myThid )
126     CALL READ_REC_XY_RS( EmPmRfile,EmPmR1,1,myIter,myThid )
127     ENDIF
128     IF ( thetaClimFile .NE. ' ' ) THEN
129     CALL READ_REC_XY_RS( thetaClimFile,SST0,intime0,myIter,myThid )
130     CALL READ_REC_XY_RS( thetaClimFile,SST1,intime1,myIter,myThid )
131     ENDIF
132     IF ( saltClimFile .NE. ' ' ) THEN
133     CALL READ_REC_XY_RS( saltClimFile,SSS0,intime0,myIter,myThid )
134     CALL READ_REC_XY_RS( saltClimFile,SSS1,intime1,myIter,myThid )
135     ENDIF
136     #ifdef SHORTWAVE_HEATING
137     IF ( surfQswFile .NE. ' ' ) THEN
138     CALL READ_REC_XY_RS( surfQswFile,Qsw0,intime0,myIter,myThid )
139     CALL READ_REC_XY_RS( surfQswFile,Qsw1,intime1,myIter,myThid )
140     ENDIF
141     #endif
142    
143     _END_MASTER(myThid)
144     C
145     _EXCH_XY_R4(SST0 , myThid )
146     _EXCH_XY_R4(SST1 , myThid )
147     _EXCH_XY_R4(SSS0 , myThid )
148     _EXCH_XY_R4(SSS1 , myThid )
149     _EXCH_XY_R4(taux0 , myThid )
150     _EXCH_XY_R4(taux1 , myThid )
151     _EXCH_XY_R4(tauy0 , myThid )
152     _EXCH_XY_R4(tauy1 , myThid )
153     _EXCH_XY_R4(Qnet0, myThid )
154     _EXCH_XY_R4(Qnet1, myThid )
155     _EXCH_XY_R4(EmPmR0, myThid )
156     _EXCH_XY_R4(EmPmR1, myThid )
157     #ifdef SHORTWAVE_HEATING
158     _EXCH_XY_R4(Qsw0, myThid )
159     _EXCH_XY_R4(Qsw1, myThid )
160     #endif
161     C
162     ENDIF
163    
164     C-- Interpolate fu,fv,Qnet,EmPmR,SST,SSS,Qsw
165     DO bj = myByLo(myThid), myByHi(myThid)
166     DO bi = myBxLo(myThid), myBxHi(myThid)
167     DO j=1-Oly,sNy+Oly
168     DO i=1-Olx,sNx+Olx
169     SST(i,j,bi,bj) = bWght*SST0(i,j,bi,bj)
170     & +aWght*SST1(i,j,bi,bj)
171     SSS(i,j,bi,bj) = bWght*SSS0(i,j,bi,bj)
172     & +aWght*SSS1(i,j,bi,bj)
173     fu(i,j,bi,bj) = bWght*taux0(i,j,bi,bj)
174     & +aWght*taux1(i,j,bi,bj)
175     fv(i,j,bi,bj) = bWght*tauy0(i,j,bi,bj)
176     & +aWght*tauy1(i,j,bi,bj)
177     Qnet(i,j,bi,bj) = bWght*Qnet0(i,j,bi,bj)
178     & +aWght*Qnet1(i,j,bi,bj)
179     EmPmR(i,j,bi,bj) = bWght*EmPmR0(i,j,bi,bj)
180     & +aWght*EmPmR1(i,j,bi,bj)
181     #ifdef SHORTWAVE_HEATING
182     Qsw(i,j,bi,bj) = bWght*Qsw0(i,j,bi,bj)
183     & +aWght*Qsw1(i,j,bi,bj)
184     #endif
185     ENDDO
186     ENDDO
187     ENDDO
188     ENDDO
189    
190     C-- Diagnostics
191     IF (myThid.EQ.1 .AND. myTime.LT.62208000.) THEN
192     write(0,'(a,1p7e12.4,2i6,2e12.4)')
193     & 'time,SST,SSS,fu,fv,Q,E-P,i0,i1,a,b = ',
194     & myTime,
195     & SST(1,sNy,1,1),SSS(1,sNy,1,1),
196     & fu(1,sNy,1,1),fv(1,sNy,1,1),
197     & Qnet(1,sNy,1,1),EmPmR(1,sNy,1,1),
198     & intime0,intime1,aWght,bWght
199     write(0,'(a,1p7e12.4)')
200     & 'time,fu0,fu1,fu = ',
201     & myTime,
202     & taux0(1,sNy,1,1),taux1(1,sNy,1,1),fu(1,sNy,1,1),
203     & aWght,bWght
204     ENDIF
205    
206     C endif for periodicForcing
207     ENDIF
208    
209     #ifdef ALLOW_AIM
210     IF ( useAIM ) THEN
211     C Update AIM bottom boundary data
212     CALL AIM_EXTERNAL_FIELDS_LOAD( myTime, myIter, myThid )
213     ENDIF
214     #endif
215    
216     RETURN
217     END
218    
219     SUBROUTINE LEF_ZERO( arr ,myThid )
220     C This routine simply sets the argument array to zero
221     C Used only by EXTERNAL_FIELDS_LOAD
222     IMPLICIT NONE
223     C === Global variables ===
224     #include "SIZE.h"
225     #include "EEPARAMS.h"
226     C === Arguments ===
227     _RS arr (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy)
228     INTEGER myThid
229     C === Local variables ===
230     INTEGER i,j,bi,bj
231    
232     DO bj = myByLo(myThid), myByHi(myThid)
233     DO bi = myBxLo(myThid), myBxHi(myThid)
234     DO j=1-Oly,sNy+Oly
235     DO i=1-Olx,sNx+Olx
236     arr(i,j,bi,bj)=0.
237     ENDDO
238     ENDDO
239     ENDDO
240     ENDDO
241    
242     RETURN
243     END

  ViewVC Help
Powered by ViewVC 1.1.22