1 | !!---------------------------------------------------------------------- |
---|
2 | !! *** limrst_fdir.h90 *** |
---|
3 | !!---------------------------------------------------------------------- |
---|
4 | !! LIM 2.0 , UCL-LODYC-IPSL (2003) |
---|
5 | !!---------------------------------------------------------------------- |
---|
6 | |
---|
7 | SUBROUTINE lim_rst_write( niter ) |
---|
8 | !!----------------------------------------------------------------------- |
---|
9 | !! output of binary files |
---|
10 | !!----------------------------------------------------------------------- |
---|
11 | !! * Arguments |
---|
12 | INTEGER :: niter ! number of iteration |
---|
13 | |
---|
14 | !- dummy variables : |
---|
15 | CHARACTER(len=45) :: & |
---|
16 | ccfile = 'restart_ice_out' |
---|
17 | INTEGER :: & |
---|
18 | ji, jj |
---|
19 | INTEGER :: & |
---|
20 | inumwrs, it0 |
---|
21 | REAL(wp),DIMENSION(jpi,jpj,35) :: & |
---|
22 | zmoment |
---|
23 | REAL(wp),DIMENSION(2) :: & |
---|
24 | zinfo |
---|
25 | !!----------------------------------------------------------------------- |
---|
26 | |
---|
27 | inumwrs = 61 |
---|
28 | OPEN ( UNIT = inumwrs , FILE = ccfile, STATUS = 'unknown', FORM='unformatted' ) |
---|
29 | |
---|
30 | it0 = niter |
---|
31 | |
---|
32 | zinfo(1) = FLOAT( nfice ) ! iteration number |
---|
33 | zinfo(2) = FLOAT( it0 ) ! time-step in second |
---|
34 | |
---|
35 | ! Write in inumwrs |
---|
36 | |
---|
37 | zmoment(:,:,1) = sxice (:,:) |
---|
38 | zmoment(:,:,2) = syice (:,:) |
---|
39 | zmoment(:,:,3) = sxxice(:,:) |
---|
40 | zmoment(:,:,4) = syyice(:,:) |
---|
41 | zmoment(:,:,5) = sxyice(:,:) |
---|
42 | zmoment(:,:,6) = sxsn (:,:) |
---|
43 | zmoment(:,:,7) = sysn (:,:) |
---|
44 | zmoment(:,:,8) = sxxsn (:,:) |
---|
45 | zmoment(:,:,9) = syysn (:,:) |
---|
46 | zmoment(:,:,10) = sxysn (:,:) |
---|
47 | zmoment(:,:,11) = sxa (:,:) |
---|
48 | zmoment(:,:,12) = sya (:,:) |
---|
49 | zmoment(:,:,13) = sxxa (:,:) |
---|
50 | zmoment(:,:,14) = syya (:,:) |
---|
51 | zmoment(:,:,15) = sxya (:,:) |
---|
52 | zmoment(:,:,16) = sxc0 (:,:) |
---|
53 | zmoment(:,:,17) = syc0 (:,:) |
---|
54 | zmoment(:,:,18) = sxxc0 (:,:) |
---|
55 | zmoment(:,:,19) = syyc0 (:,:) |
---|
56 | zmoment(:,:,20) = sxyc0 (:,:) |
---|
57 | zmoment(:,:,21) = sxc1 (:,:) |
---|
58 | zmoment(:,:,22) = syc1 (:,:) |
---|
59 | zmoment(:,:,23) = sxxc1 (:,:) |
---|
60 | zmoment(:,:,24) = syyc1 (:,:) |
---|
61 | zmoment(:,:,25) = sxyc1 (:,:) |
---|
62 | zmoment(:,:,26) = sxc2 (:,:) |
---|
63 | zmoment(:,:,27) = syc2 (:,:) |
---|
64 | zmoment(:,:,28) = sxxc2 (:,:) |
---|
65 | zmoment(:,:,29) = syyc2 (:,:) |
---|
66 | zmoment(:,:,30) = sxyc2 (:,:) |
---|
67 | zmoment(:,:,31) = sxst (:,:) |
---|
68 | zmoment(:,:,32) = syst (:,:) |
---|
69 | zmoment(:,:,33) = sxxst (:,:) |
---|
70 | zmoment(:,:,34) = syyst (:,:) |
---|
71 | zmoment(:,:,35) = sxyst (:,:) |
---|
72 | |
---|
73 | WRITE(inumwrs) zinfo ! restart informations |
---|
74 | |
---|
75 | WRITE(inumwrs) hicif ! prognostic variables |
---|
76 | WRITE(inumwrs) hsnif |
---|
77 | WRITE(inumwrs) frld |
---|
78 | WRITE(inumwrs) sist |
---|
79 | # if defined key_coupled |
---|
80 | WRITE(inumwrs) albege |
---|
81 | # endif |
---|
82 | WRITE(inumwrs) tbif |
---|
83 | WRITE(inumwrs) u_ice |
---|
84 | WRITE(inumwrs) v_ice |
---|
85 | WRITE(inumwrs) gtaux |
---|
86 | WRITE(inumwrs) gtauy |
---|
87 | WRITE(inumwrs) qstoif |
---|
88 | WRITE(inumwrs) fsbbq |
---|
89 | WRITE(inumwrs) zmoment |
---|
90 | |
---|
91 | CLOSE(inumwrs) |
---|
92 | |
---|
93 | END SUBROUTINE lim_rst_write |
---|
94 | |
---|
95 | |
---|
96 | SUBROUTINE lim_rst_read(niter ) |
---|
97 | !!----------------------------------------------------------------------- |
---|
98 | !! restart from a state defined in a binary file |
---|
99 | !!----------------------------------------------------------------------- |
---|
100 | !! * Arguments |
---|
101 | INTEGER :: niter ! number of iteration |
---|
102 | |
---|
103 | !- dummy variables : |
---|
104 | CHARACTER(len=45) :: & |
---|
105 | ccfile = 'restart_ice.in' |
---|
106 | |
---|
107 | INTEGER :: & |
---|
108 | ji, jj |
---|
109 | INTEGER :: & |
---|
110 | inumrst, it0, it1, ifice |
---|
111 | REAL(wp),DIMENSION(jpi,jpj,35) :: & |
---|
112 | zmoment |
---|
113 | REAL(wp),DIMENSION(2) :: & |
---|
114 | zinfo |
---|
115 | !!----------------------------------------------------------------------- |
---|
116 | |
---|
117 | !Initialisations |
---|
118 | inumrst = 71 |
---|
119 | |
---|
120 | !Read inumrst |
---|
121 | OPEN( UNIT = inumrst, FILE = ccfile, STATUS = 'old', FORM = 'unformatted') |
---|
122 | |
---|
123 | it0 = nit000 |
---|
124 | |
---|
125 | READ(inumrst) zinfo ! restart informations |
---|
126 | |
---|
127 | ifice = INT( zinfo(1) ) |
---|
128 | it1 = INT( zinfo(2) ) |
---|
129 | |
---|
130 | WRITE(numout,*) |
---|
131 | WRITE(numout,*) 'lim_rst_fdir : READ restart file name ', ccfile, ' at time step : ', it1 |
---|
132 | WRITE(numout,*) '~~~~~~~~~~~~' |
---|
133 | |
---|
134 | |
---|
135 | !Control of date |
---|
136 | |
---|
137 | IF( ( it0 - it1 ) /= 1 .AND. ABS( nrstdt ) == 1 ) THEN |
---|
138 | WRITE(numout,cform_err) |
---|
139 | WRITE(numout,*) ' ===>>>> : problem with nit000 for the restart' |
---|
140 | WRITE(numout,*) ' we stop. verify the file or rerun with the value 0 for the' |
---|
141 | WRITE(numout,*) ' control of time parameter nrstdt' |
---|
142 | nstop = nstop + 1 |
---|
143 | ENDIF |
---|
144 | |
---|
145 | |
---|
146 | READ(inumrst) hicif ! prognostic variables |
---|
147 | READ(inumrst) hsnif |
---|
148 | READ(inumrst) frld |
---|
149 | READ(inumrst) sist |
---|
150 | # if defined key_coupled |
---|
151 | READ(inumrst) albege |
---|
152 | # endif |
---|
153 | READ(inumrst) tbif |
---|
154 | READ(inumrst) u_ice |
---|
155 | READ(inumrst) v_ice |
---|
156 | READ(inumrst) gtaux |
---|
157 | READ(inumrst) gtauy |
---|
158 | READ(inumrst) qstoif |
---|
159 | READ(inumrst) fsbbq |
---|
160 | READ(inumrst) zmoment |
---|
161 | |
---|
162 | CLOSE(inumrst) |
---|
163 | |
---|
164 | niter = it1 |
---|
165 | tsec = ztotsec |
---|
166 | DO jj = 1, jpj |
---|
167 | DO ji = 1, jpi |
---|
168 | sxice(ji,jj) = zmoment(ji,jj,1) |
---|
169 | syice(ji,jj) = zmoment(ji,jj,2) |
---|
170 | sxxice(ji,jj) = zmoment(ji,jj,3) |
---|
171 | syyice(ji,jj) = zmoment(ji,jj,4) |
---|
172 | sxyice(ji,jj) = zmoment(ji,jj,5) |
---|
173 | sxsn(ji,jj) = zmoment(ji,jj,6) |
---|
174 | sysn(ji,jj) = zmoment(ji,jj,7) |
---|
175 | sxxsn(ji,jj) = zmoment(ji,jj,8) |
---|
176 | syysn(ji,jj) = zmoment(ji,jj,9) |
---|
177 | sxysn(ji,jj) = zmoment(ji,jj,10) |
---|
178 | sxa(ji,jj) = zmoment(ji,jj,11) |
---|
179 | sya(ji,jj) = zmoment(ji,jj,12) |
---|
180 | sxxa(ji,jj) = zmoment(ji,jj,13) |
---|
181 | syya(ji,jj) = zmoment(ji,jj,14) |
---|
182 | sxya(ji,jj) = zmoment(ji,jj,15) |
---|
183 | sxc0(ji,jj) = zmoment(ji,jj,16) |
---|
184 | syc0(ji,jj) = zmoment(ji,jj,17) |
---|
185 | sxxc0(ji,jj) = zmoment(ji,jj,18) |
---|
186 | syyc0(ji,jj) = zmoment(ji,jj,19) |
---|
187 | sxyc0(ji,jj) = zmoment(ji,jj,20) |
---|
188 | sxc1(ji,jj) = zmoment(ji,jj,21) |
---|
189 | syc1(ji,jj) = zmoment(ji,jj,22) |
---|
190 | sxxc1(ji,jj) = zmoment(ji,jj,23) |
---|
191 | syyc1(ji,jj) = zmoment(ji,jj,24) |
---|
192 | sxyc1(ji,jj) = zmoment(ji,jj,25) |
---|
193 | sxc2(ji,jj) = zmoment(ji,jj,26) |
---|
194 | syc2(ji,jj) = zmoment(ji,jj,27) |
---|
195 | sxxc2(ji,jj) = zmoment(ji,jj,28) |
---|
196 | syyc2(ji,jj) = zmoment(ji,jj,29) |
---|
197 | sxyc2(ji,jj) = zmoment(ji,jj,30) |
---|
198 | sxst(ji,jj) = zmoment(ji,jj,31) |
---|
199 | syst(ji,jj) = zmoment(ji,jj,32) |
---|
200 | sxxst(ji,jj) = zmoment(ji,jj,33) |
---|
201 | syyst(ji,jj) = zmoment(ji,jj,34) |
---|
202 | sxyst(ji,jj) = zmoment(ji,jj,35) |
---|
203 | END DO |
---|
204 | END DO |
---|
205 | |
---|
206 | END SUBROUTINE lim_rst_read |
---|