New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
limrst_dimg.h90 in trunk/NEMO/LIM_SRC – NEMO

source: trunk/NEMO/LIM_SRC/limrst_dimg.h90 @ 247

Last change on this file since 247 was 247, checked in by opalod, 19 years ago

CL : Add CVS Header and CeCILL licence information

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.9 KB
Line 
1   !!----------------------------------------------------------------------
2   !!                     *** limrst_dimg.h90  ***
3   !!----------------------------------------------------------------------
4   !!   LIM 2.0,  UCL-LOCEAN-IPSL (2005)
5   !! $Header$
6   !! This software is governed by the CeCILL licence see modipsl/doc/NEMO_CeCILL.txt
7   !!----------------------------------------------------------------------
8
9   SUBROUTINE lim_rst_write( kt )
10      !!-----------------------------------------------------------------------
11      !!                  ***  ROUTINE lim_rst_write  ***
12      !!
13      !! ** Purpose : Write restart fields for the LIM in mpp.
14      !!    one file per process, in the same manner as the ocean.
15      !! 
16      !! ** Methode : Each nstock time step, save  which are necessary
17      !!      for restart
18      !!      Record #1 hold general information on the state of the run
19      !!      Data fields (either 3D or 2D ) starts ar record #2
20      !!
21      !! History :
22      !!   9.0   : 04-05 (J.M. Molines ) from limrst_fdir.h90
23      !!-----------------------------------------------------------------------
24      !! * Arguments
25      USE par_ice
26      INTEGER, INTENT(in)  ::   kt        ! number of iteration
27
28      !- dummy variables :
29      INTEGER :: ji, jj, jf
30      INTEGER :: inum=61, it0, irecl8, irec
31
32      REAL(wp),DIMENSION(jpi,jpj,35) ::  zmoment
33      REAL(wp),DIMENSION(2)          :: zinfo
34
35      CHARACTER(len=45)  ::   ccfile = 'restart_ice_out', clres
36      !!-----------------------------------------------------------------------
37           
38      !! This routine is called from icestep if it is the right time to use it.
39      !! no additional check is necessary.
40
41       ! 0. Initializations
42       ! ------------------
43
44       IF(lwp) THEN
45          WRITE(numout,*) ' '
46          WRITE(numout,*) ' lim_rst_write: output done in inum = ',   &
47               inum,' at it= ',kt,' date= ',ndastp
48          WRITE(numout,*) ' -------'
49       ENDIF
50
51       ! Open direct access file, with reclength for 2D wp fields
52       irecl8= jpi * jpj * wp
53       WRITE(clres,'(a,".",i3.3)') TRIM(ccfile),narea
54       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=irecl8 )
55
56
57      it0      = kt
58     
59      zinfo(1) = FLOAT( nfice )   ! iteration number
60      zinfo(2) = FLOAT( it0 )        ! time-step in second
61
62      ! Write in inum
63
64      zmoment(:,:,1)  = sxice (:,:)
65      zmoment(:,:,2)  = syice (:,:)
66      zmoment(:,:,3)  = sxxice(:,:)
67      zmoment(:,:,4)  = syyice(:,:)
68      zmoment(:,:,5)  = sxyice(:,:)
69      zmoment(:,:,6)  = sxsn  (:,:)
70      zmoment(:,:,7)  = sysn  (:,:)
71      zmoment(:,:,8)  = sxxsn (:,:)
72      zmoment(:,:,9)  = syysn (:,:)
73      zmoment(:,:,10) = sxysn (:,:)
74      zmoment(:,:,11) = sxa   (:,:)
75      zmoment(:,:,12) = sya   (:,:)
76      zmoment(:,:,13) = sxxa  (:,:)
77      zmoment(:,:,14) = syya  (:,:)
78      zmoment(:,:,15) = sxya  (:,:)
79      zmoment(:,:,16) = sxc0  (:,:)
80      zmoment(:,:,17) = syc0  (:,:)
81      zmoment(:,:,18) = sxxc0 (:,:)
82      zmoment(:,:,19) = syyc0 (:,:)
83      zmoment(:,:,20) = sxyc0 (:,:)
84      zmoment(:,:,21) = sxc1  (:,:)
85      zmoment(:,:,22) = syc1  (:,:)
86      zmoment(:,:,23) = sxxc1 (:,:)
87      zmoment(:,:,24) = syyc1 (:,:)
88      zmoment(:,:,25) = sxyc1 (:,:)
89      zmoment(:,:,26) = sxc2  (:,:)
90      zmoment(:,:,27) = syc2  (:,:)
91      zmoment(:,:,28) = sxxc2 (:,:)
92      zmoment(:,:,29) = syyc2 (:,:)
93      zmoment(:,:,30) = sxyc2 (:,:)
94      zmoment(:,:,31) = sxst  (:,:)
95      zmoment(:,:,32) = syst  (:,:)
96      zmoment(:,:,33) = sxxst (:,:)
97      zmoment(:,:,34) = syyst (:,:)
98      zmoment(:,:,35) = sxyst (:,:)
99
100      WRITE(inum,REC=1) irecl8, nfice, it0, &
101          &              ndastp, adatrj, jpi, jpj, jpk,  &
102          &              jpni, jpnj, jpnij, narea, jpiglo, jpjglo, &
103          &              nlcit, nlcjt, nldit, nldjt, nleit, nlejt, nimppt, njmppt
104
105      irec= 2
106      WRITE(inum,REC=irec)  hicif(:,:)          ! prognostic variables
107      irec = irec + 1
108      WRITE(inum,REC=irec)  hsnif(:,:)
109      irec = irec + 1
110      WRITE(inum,REC=irec)  frld(:,:)
111      irec = irec + 1
112      WRITE(inum,REC=irec)  sist(:,:)
113      irec = irec + 1
114# if defined key_coupled
115      WRITE(inum,REC=irec)  albege(:,:)
116      irec = irec + 1
117# endif
118      DO jf=1, jplayersp1
119      WRITE(inum,REC=irec)  tbif(:,:,jf)
120      irec = irec + 1
121      END DO
122      WRITE(inum,REC=irec)  u_ice(:,:)
123      irec = irec + 1
124      WRITE(inum,REC=irec)  v_ice(:,:)
125      irec = irec + 1
126      WRITE(inum,REC=irec)  gtaux(:,:)
127      irec = irec + 1
128      WRITE(inum,REC=irec)  gtauy(:,:)
129      irec = irec + 1
130      WRITE(inum,REC=irec)  qstoif(:,:)
131      irec = irec + 1
132      WRITE(inum,REC=irec)  fsbbq(:,:)
133      irec = irec + 1
134      DO jf=1,35
135      WRITE(inum,REC=irec)  zmoment(:,:,jf)
136      irec = irec + 1
137      END DO
138 
139      CLOSE(inum)
140     
141   END SUBROUTINE lim_rst_write
142
143
144   SUBROUTINE lim_rst_read(kt )
145      !!-----------------------------------------------------------------------
146      !!  restart from a state defined in a binary file
147      !!-----------------------------------------------------------------------
148      !! * Arguments
149      USE par_ice
150      INTEGER ,INTENT(out)  ::   kt        ! number of iteration
151
152      !- dummy variables :
153
154      INTEGER :: ji, jj, jf
155      INTEGER :: inum=71, it0, it1, ifice, irecl8, irec
156
157      REAL(wp),DIMENSION(jpi,jpj,35) ::  zmoment
158      REAL(wp),DIMENSION(2) :: zinfo
159
160      CHARACTER(len=45)  ::   ccfile = 'restart_ice_in',clres
161      !!-----------------------------------------------------------------------
162
163      !Initialisations
164
165       ! Open direct access file, with reclength for 2D wp fields
166       WRITE(clres,'(a,".",i3.3)') TRIM(ccfile),narea
167       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=8)
168       READ(inum,REC=1) irecl8
169       CLOSE(inum)
170
171       OPEN(inum,FILE=clres,FORM='UNFORMATTED', ACCESS='DIRECT', RECL=irecl8)
172       READ(inum,REC=1) irecl8, ifice, it1
173     
174
175      !Read inumrst
176
177      it0          = nit000
178
179
180      IF (lwp) THEN
181      WRITE(numout,*)
182      WRITE(numout,*) 'lim_rst_fdir :  READ restart file name ', ccfile, ' at time step : ', it1
183      WRITE(numout,*) '~~~~~~~~~~~~'
184      END IF
185
186
187      !Control of date
188     
189      IF( ( it0 - it1 ) /= 1 .AND. ABS( nrstdt ) == 1 ) THEN
190         IF (lwp) THEN
191         WRITE(numout,cform_err)
192         WRITE(numout,*) ' ===>>>> : problem with nit000 for the restart'
193         WRITE(numout,*) ' we stop. verify the file or rerun with the value  0 for the'
194         WRITE(numout,*) ' control of time parameter  nrstdt'
195         END IF
196         nstop = nstop + 1
197      ENDIF
198
199
200      irec = 2
201      READ(inum,REC=irec)  hicif(:,:)    ! prognostic variables
202      irec = irec +1
203      READ(inum,REC=irec)  hsnif(:,:)
204      irec = irec +1
205      READ(inum,REC=irec)  frld(:,:)
206      irec = irec +1
207      READ(inum,REC=irec)  sist(:,:)
208      irec = irec +1
209# if defined key_coupled
210      READ(inum,REC=irec)  albege(:,:)
211      irec = irec +1
212# endif
213      DO jf = 1, jplayersp1
214      READ(inum,REC=irec)  tbif(:,:,jf)
215      irec = irec +1
216      END DO
217      READ(inum,REC=irec)  u_ice(:,:)
218      irec = irec +1
219      READ(inum,REC=irec)  v_ice(:,:)
220      irec = irec +1
221      READ(inum,REC=irec)  gtaux(:,:)
222      irec = irec +1
223      READ(inum,REC=irec)  gtauy(:,:)
224      irec = irec +1
225      READ(inum,REC=irec)  qstoif(:,:)
226      irec = irec +1
227      READ(inum,REC=irec)  fsbbq(:,:)
228      irec = irec +1
229      DO jf = 1, 35
230      READ(inum,REC=irec)  zmoment(:,:,jf)
231      irec = irec +1
232      END DO
233 
234      CLOSE(inum)
235
236      kt = it1
237            sxice(:,:)  = zmoment(:,:,1)
238            syice(:,:)  = zmoment(:,:,2)
239            sxxice(:,:) = zmoment(:,:,3)
240            syyice(:,:) = zmoment(:,:,4)
241            sxyice(:,:) = zmoment(:,:,5)
242            sxsn(:,:)   = zmoment(:,:,6)
243            sysn(:,:)   = zmoment(:,:,7)
244            sxxsn(:,:)  = zmoment(:,:,8)
245            syysn(:,:)  = zmoment(:,:,9)
246            sxysn(:,:)  = zmoment(:,:,10)
247            sxa(:,:)    = zmoment(:,:,11)
248            sya(:,:)    = zmoment(:,:,12)
249            sxxa(:,:)   = zmoment(:,:,13)
250            syya(:,:)   = zmoment(:,:,14)
251            sxya(:,:)   = zmoment(:,:,15)
252            sxc0(:,:)   = zmoment(:,:,16)
253            syc0(:,:)   = zmoment(:,:,17)
254            sxxc0(:,:)  = zmoment(:,:,18)
255            syyc0(:,:)  = zmoment(:,:,19)
256            sxyc0(:,:)  = zmoment(:,:,20)
257            sxc1(:,:)   = zmoment(:,:,21)
258            syc1(:,:)   = zmoment(:,:,22)
259            sxxc1(:,:)  = zmoment(:,:,23)
260            syyc1(:,:)  = zmoment(:,:,24)
261            sxyc1(:,:)  = zmoment(:,:,25)
262            sxc2(:,:)   = zmoment(:,:,26)
263            syc2(:,:)   = zmoment(:,:,27)
264            sxxc2(:,:)  = zmoment(:,:,28)
265            syyc2(:,:)  = zmoment(:,:,29)
266            sxyc2(:,:)  = zmoment(:,:,30)
267            sxst(:,:)   = zmoment(:,:,31)
268            syst(:,:)   = zmoment(:,:,32)
269            sxxst(:,:)  = zmoment(:,:,33)
270            syyst(:,:)  = zmoment(:,:,34)
271            sxyst(:,:)  = zmoment(:,:,35)
272     
273   END SUBROUTINE lim_rst_read
Note: See TracBrowser for help on using the repository browser.