[44] | 1 | ;------------------------------------------------------------ |
---|
| 2 | ;------------------------------------------------------------ |
---|
| 3 | ;------------------------------------------------------------ |
---|
| 4 | ;+ |
---|
| 5 | ; |
---|
[106] | 6 | ; @categories for OPA before NetCDF |
---|
[44] | 7 | ; |
---|
[106] | 8 | ; @restrictions bug for etab and etan written on the same record??? |
---|
[44] | 9 | ; |
---|
[106] | 10 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
[44] | 11 | ; June 2002 |
---|
| 12 | ;- |
---|
| 13 | ;------------------------------------------------------------ |
---|
| 14 | ;------------------------------------------------------------ |
---|
| 15 | ;------------------------------------------------------------ |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | FUNCTION read2fromopa, unit, params, num |
---|
| 19 | offset=params.reclen*params.jpk*(num-1L) |
---|
| 20 | a=assoc(unit,dblarr(params.jpiglo,params.jpjglo,/nozero),offset) |
---|
| 21 | return, a[0] |
---|
| 22 | end |
---|
[106] | 23 | ;+ |
---|
| 24 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 25 | ; June 2002 |
---|
| 26 | ;- |
---|
[44] | 27 | FUNCTION read3fromopa, unit, params, num |
---|
| 28 | offset=params.reclen*params.jpk*(num-1L) |
---|
| 29 | a=assoc(unit,dblarr(params.jpiglo,params.jpjglo,params.jpk,/nozero),offset) |
---|
| 30 | return, a[0] |
---|
| 31 | end |
---|
| 32 | |
---|
[106] | 33 | ;+ |
---|
| 34 | ; @file_comments read the old restart files of OPA (before NetCDF) |
---|
| 35 | ; based on the OPA subroutine dtrlec included at the end of the |
---|
| 36 | ; file. |
---|
| 37 | ; @categories for OPA before NetCDF |
---|
| 38 | ; @param filename {in}{required} with the whole path if necessary |
---|
| 39 | ; @param jpiglo {in}{required} |
---|
| 40 | ; @param jpjglo {in}{required} |
---|
| 41 | ; @param jpk {in}{required} |
---|
| 42 | ; dimensions of the opa grid |
---|
| 43 | ; @keyword IBLOC ibloc size, default: ibloc = 4096L |
---|
| 44 | ; @keyword JPBYT jpbyt size, defalut: jpbyt = 8L |
---|
| 45 | ; @keyword NUMREC number of records in the file. defalut: numrec = 19L*jpk |
---|
| 46 | ; @keyword UB |
---|
| 47 | ; @keyword VB |
---|
| 48 | ; @keyword TB |
---|
| 49 | ; @keyword SB |
---|
| 50 | ; @keyword ROTB |
---|
| 51 | ; @keyword HDIVB |
---|
| 52 | ; @keyword UN |
---|
| 53 | ; @keyword VN |
---|
| 54 | ; @keyword TN |
---|
| 55 | ; @keyword SN |
---|
| 56 | ; @keyword ROTN |
---|
| 57 | ; @keyword HDIVN |
---|
| 58 | ; @keyword GCX |
---|
| 59 | ; @keyword GCXB |
---|
| 60 | ; @keyword ETAB |
---|
| 61 | ; @keyword ETAN |
---|
| 62 | ; @keyword BSFB |
---|
| 63 | ; @keyword BSFN |
---|
| 64 | ; @keyword BSFD |
---|
| 65 | ; @keyword EN |
---|
| 66 | ; the variable we want to read. |
---|
| 67 | ; |
---|
| 68 | ; @returns according to the given keywords. |
---|
| 69 | ; @restrictions bug for etab and etan written on the same record??? |
---|
| 70 | ; |
---|
| 71 | ; @history Sebastien Masson (smasson\@lodyc.jussieu.fr) |
---|
| 72 | ; June 2002 |
---|
| 73 | ;- |
---|
[44] | 74 | |
---|
| 75 | PRO readoldoparestart, filename, jpiglo, jpjglo, jpk, IBLOC = ibloc, JPBYT = jpbyt, NUMREC = numrec, ub = ub, vb = vb, tb = tb, sb = sb, rotb = rotb, hdivb = hdivb, un = un, vn = vn, tn = tn, sn = sn, rotn = rotn, hdivn = hdivn, gcx = gcx, gcxb = gcxb, etab = etab, etan = etan, bsfb = bsfb, bsfn = bsfn, bsfd = bsfd, en = en |
---|
| 76 | ; |
---|
| 77 | iname_file = findfile(filename) |
---|
| 78 | if iname_file[0] EQ '' then begin |
---|
| 79 | print, 'Bad file name' |
---|
| 80 | return |
---|
| 81 | ENDIF ELSE iname_file = iname_file[0] |
---|
| 82 | ; open the file |
---|
| 83 | openr,numrst , iname_file, /get_lun, /swap_if_little_endian |
---|
| 84 | ; check the size of the file |
---|
| 85 | filepamameters = fstat(numrst) |
---|
| 86 | ; parameter definition |
---|
| 87 | IF keyword_set(ibloc) THEN ibloc = long(ibloc) ELSE ibloc = 4096L |
---|
| 88 | jpiglo = long(jpiglo) |
---|
| 89 | jpjglo = long(jpjglo) |
---|
| 90 | jpk = long(jpk) |
---|
| 91 | IF keyword_set(jpbyt) THEN jpbyt = long(jpbyt) ELSE jpbyt = 8L |
---|
| 92 | ; record length computation |
---|
| 93 | reclen = ibloc*((jpiglo*jpjglo*jpbyt-1 )/ibloc+1) |
---|
| 94 | IF keyword_set(numrec) THEN numrec = long(numrec) ELSE numrec = 19L*jpk |
---|
| 95 | toomuch = reclen-jpiglo*jpjglo*jpbyt |
---|
| 96 | ; expected size computation |
---|
| 97 | size = numrec*reclen-toomuch |
---|
[74] | 98 | if size NE filepamameters.size then begin |
---|
[44] | 99 | print, 'The size of the file is not the expected one!' |
---|
| 100 | print, 'Check your file or the values of ibloc, jpiglo,' |
---|
| 101 | print, 'jpjglo, jpk, jpbyt, numrec in this program' |
---|
| 102 | return |
---|
| 103 | endif |
---|
| 104 | ; first record: six 64-bit integer to read. |
---|
| 105 | ; default definition |
---|
| 106 | ino1 = long64(9999) |
---|
| 107 | it1 = long64(9999) |
---|
| 108 | isor1 = long64(9999) |
---|
| 109 | ipcg1 = long64(9999) |
---|
| 110 | itke1 = long64(9999) |
---|
| 111 | idast1 = long64(9999) |
---|
| 112 | ; read |
---|
| 113 | readu, numrst, ino1, it1, isor1, ipcg1, itke1, idast1 |
---|
| 114 | print, ino1, it1, isor1, ipcg1, itke1, idast1 |
---|
| 115 | ; other records |
---|
| 116 | params = {jpiglo:jpiglo, jpjglo:jpjglo, jpk:jpk, reclen:reclen} |
---|
| 117 | ; CALL read3(numrst,ub ,2 ) |
---|
| 118 | IF arg_present(ub) THEN ub = read3fromopa(numrst, params, 2) |
---|
| 119 | ; CALL read3(numrst,vb ,3 ) |
---|
| 120 | IF arg_present(vb) THEN vb = read3fromopa(numrst, params, 3) |
---|
| 121 | ; CALL read3(numrst,tb ,5 ) |
---|
| 122 | IF arg_present(tb) THEN tb = read3fromopa(numrst, params, 5) |
---|
| 123 | ; CALL read3(numrst,sb ,6 ) |
---|
| 124 | IF arg_present(sb) THEN sb = read3fromopa(numrst, params, 6) |
---|
| 125 | ; CALL read3(numrst,rotb ,7 ) |
---|
| 126 | IF arg_present(rotb) THEN rotb = read3fromopa(numrst, params, 7) |
---|
| 127 | ; CALL read3(numrst,hdivb,8 ) |
---|
| 128 | IF arg_present(hdivb) THEN hdivb = read3fromopa(numrst, params, 8) |
---|
| 129 | ; CALL read3(numrst,un ,9 ) |
---|
| 130 | IF arg_present(un) THEN un = read3fromopa(numrst, params, 9) |
---|
| 131 | ; CALL read3(numrst,vn ,10) |
---|
| 132 | IF arg_present(vn) THEN vn = read3fromopa(numrst, params, 10) |
---|
| 133 | ; CALL read3(numrst,tn ,12) |
---|
| 134 | IF arg_present(tn) THEN tn = read3fromopa(numrst, params, 12) |
---|
| 135 | ; CALL read3(numrst,sn ,13) |
---|
| 136 | IF arg_present(sn) THEN sn = read3fromopa(numrst, params, 13) |
---|
| 137 | ; CALL read3(numrst,rotn ,14) |
---|
| 138 | IF arg_present(rotn) THEN rotn = read3fromopa(numrst, params, 14) |
---|
| 139 | ; CALL read3(numrst,hdivn,15) |
---|
| 140 | IF arg_present(hdivn) THEN hdivn = read3fromopa(numrst, params, 15) |
---|
| 141 | ;C |
---|
| 142 | ;C ... Read elliptic solver arrays |
---|
| 143 | ;C |
---|
| 144 | ; CALL read2(numrst,gcx ,jpk,17) |
---|
| 145 | IF arg_present(gcx) THEN gcx = read2fromopa(numrst, params, 17) |
---|
| 146 | ; CALL read2(numrst,gcxb,jpk,18) |
---|
| 147 | IF arg_present(gcxb) THEN gcxb = read2fromopa(numrst, params, 18) |
---|
| 148 | ;C |
---|
| 149 | ;#ifdef key_freesurf_cstvol |
---|
| 150 | ;C |
---|
| 151 | ;C ... free surface formulation (eta) |
---|
| 152 | ;C |
---|
| 153 | ; CALL read2(numrst,etab ,jpk,4 ) |
---|
| 154 | IF arg_present(etab) THEN etab = read2fromopa(numrst, params, 4) |
---|
| 155 | ; CALL read2(numrst,etan ,jpk,4 ) |
---|
| 156 | IF arg_present(etan) THEN etan = read2fromopa(numrst, params, 4) |
---|
| 157 | ;# else |
---|
| 158 | ;C |
---|
| 159 | ;C ... Rigid-lid formulation (bsf) |
---|
| 160 | ;C |
---|
| 161 | ; CALL read2(numrst,bsfb ,jpk,4 ) |
---|
| 162 | IF arg_present(bsfb) THEN bsfb = read2fromopa(numrst, params, 4) |
---|
| 163 | ; CALL read2(numrst,bsfn ,jpk,11) |
---|
| 164 | IF arg_present(bsfn) THEN bsfn = read2fromopa(numrst, params, 11) |
---|
| 165 | ; CALL read2(numrst,bsfd ,jpk,16) |
---|
[74] | 166 | IF arg_present(bsfd) THEN bsfd = read2fromopa(numrst, params, 16) |
---|
[44] | 167 | ;#endif |
---|
| 168 | ;#ifdef key_zdftke |
---|
| 169 | ; CALL read3(numrst,en,19) |
---|
| 170 | IF arg_present(en) THEN en = read3fromopa(numrst, params, 19) |
---|
| 171 | |
---|
| 172 | |
---|
| 173 | |
---|
| 174 | close, numrst |
---|
| 175 | free_lun, numrst |
---|
| 176 | |
---|
| 177 | return |
---|
| 178 | end |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | ;CDIR$ LIST |
---|
| 183 | ; SUBROUTINE dtrlec |
---|
| 184 | ;CCC--------------------------------------------------------------------- |
---|
| 185 | ;CCC |
---|
| 186 | ;CCC ROUTINE dtrlec |
---|
| 187 | ;CCC ****************** |
---|
| 188 | ;CCC |
---|
| 189 | ;CCC Purpose : |
---|
| 190 | ;CCC -------- |
---|
| 191 | ;CCC Read files for restart |
---|
| 192 | ;CCC |
---|
| 193 | ;CC Method : |
---|
| 194 | ;CC ------- |
---|
| 195 | ;CC Read the previous fields on the file numrst |
---|
| 196 | ;CC the first record indicates previous characterics |
---|
| 197 | ;CC after control with the present run, we read : |
---|
| 198 | ;CC - prognostic variables on the second record |
---|
| 199 | ;CC - elliptic solver arrays |
---|
| 200 | ;CC - barotropic stream function arrays (default option) |
---|
| 201 | ;CC or free surface arrays ("key_freesurf_cstvol" defined) |
---|
| 202 | ;CC - tke arrays ("key_zdftke" defined) |
---|
| 203 | ;CC for this last three records, the previous characteristics |
---|
| 204 | ;CC could be different with those used in the present run. |
---|
| 205 | ;CC |
---|
| 206 | ;CC Input : |
---|
| 207 | ;CC ------ |
---|
| 208 | ;CC common |
---|
| 209 | ;CC /comrst/ : restart parameter |
---|
| 210 | ;CC /comctl/ : parameters for the control |
---|
| 211 | ;CC |
---|
| 212 | ;CC Output : |
---|
| 213 | ;CC ------- |
---|
| 214 | ;CC common |
---|
| 215 | ;CC /combef/ : previous fields (before) |
---|
| 216 | ;CC /comnow/ : present fields (now) |
---|
| 217 | ;CC /combsf/ : barotropic stream function |
---|
| 218 | ;CC /comspg/ : surface pressure |
---|
| 219 | ;CC /comsol/ : diagonal preconditioned conjugate |
---|
| 220 | ;CC |
---|
| 221 | ;CC Modifications : |
---|
| 222 | ;CC -------------- |
---|
| 223 | ;CC original : 91-03 () |
---|
| 224 | ;CC additions : 92-01 (M. Imbard) |
---|
| 225 | ;CC : 92-06 correction restart file (M. Imbard) |
---|
| 226 | ;CC : 98-02 (M. Guyon) FETI method |
---|
| 227 | ;CC addition : 98-05 (G. Roullet) free surface |
---|
| 228 | ;CC---------------------------------------------------------------------- |
---|
| 229 | ;CC parameters and commons |
---|
| 230 | ;CC ====================== |
---|
| 231 | ;CDIR$ NOLIST |
---|
| 232 | ;#include "parameter.h" |
---|
| 233 | ;#include "common.h" |
---|
| 234 | ;CDIR$ LIST |
---|
| 235 | ;CC---------------------------------------------------------------------- |
---|
| 236 | ;CC local declarations |
---|
| 237 | ;CC ================== |
---|
| 238 | ; INTEGER ji, jj, jk, jl |
---|
| 239 | ; INTEGER ino0, it0, ipcg0, isor0, itke0 |
---|
| 240 | ; INTEGER ino1, it1, isor1, ipcg1, itke1, idast1 |
---|
| 241 | ;CC---------------------------------------------------------------------- |
---|
| 242 | ;CC statement functions |
---|
| 243 | ;CC =================== |
---|
| 244 | ;CDIR$ NOLIST |
---|
| 245 | ;#include "stafun.h" |
---|
| 246 | ;CDIR$ LIST |
---|
| 247 | ;CCC--------------------------------------------------------------------- |
---|
| 248 | ;CCC OPA8, LODYC (1997) |
---|
| 249 | ;CCC--------------------------------------------------------------------- |
---|
| 250 | ;C |
---|
| 251 | ;C |
---|
| 252 | ;C 0. Initialisations |
---|
| 253 | ;C ------------------ |
---|
| 254 | ;C |
---|
| 255 | ; ino0 = no |
---|
| 256 | ; it0 = nit000 |
---|
| 257 | ; ipcg0 = 0 |
---|
| 258 | ; isor0 = 0 |
---|
| 259 | ; itke0 = 0 |
---|
| 260 | ; isor0 = nsolv-1 |
---|
| 261 | ; ipcg0 = 2-nsolv |
---|
| 262 | ;#ifdef key_zdftke |
---|
| 263 | ; itke0 = 1 |
---|
| 264 | ;#endif |
---|
| 265 | ;C FETI method |
---|
| 266 | ; IF (nsolv .EQ. 3) THEN |
---|
| 267 | ; isor0=2 |
---|
| 268 | ; ipcg0=2 |
---|
| 269 | ; ENDIF |
---|
| 270 | ;C |
---|
| 271 | ; IF(lwp) THEN |
---|
| 272 | ; WRITE(numout,*) ' ' |
---|
| 273 | ; WRITE(numout,*) ' *** dtrlec: beginning of restart' |
---|
| 274 | ; WRITE(numout,*) ' ' |
---|
| 275 | ; WRITE(numout,*) ' the present run :' |
---|
| 276 | ; WRITE(numout,*) ' job number : ', no |
---|
| 277 | ; WRITE(numout,*) ' with nit000 : ', nit000 |
---|
| 278 | ; WRITE(numout,*) ' with pcg option ipcg0 : ', ipcg0 |
---|
| 279 | ; WRITE(numout,*) ' with sor option isor0 : ', isor0 |
---|
| 280 | ; WRITE(numout,*) ' with FETI solver option ipcg0 & isor0 : ', |
---|
| 281 | ; $ ipcg0,' & ',isor0 |
---|
| 282 | ; WRITE(numout,*) ' with tke option itke0 : ', itke0 |
---|
| 283 | ; ENDIF |
---|
| 284 | ;C |
---|
| 285 | ;C 1. Read numrst |
---|
| 286 | ;C -------------- |
---|
| 287 | ;C |
---|
| 288 | ;C ... First record |
---|
| 289 | ;C |
---|
| 290 | ; READ(numrst,REC=1) ino1, it1, isor1, ipcg1, itke1, idast1 |
---|
| 291 | ;C |
---|
| 292 | ; IF(lwp) THEN |
---|
| 293 | ; WRITE(numout,*) ' ' |
---|
| 294 | ; WRITE(numout,*) ' READ numrst with ' |
---|
| 295 | ; WRITE(numout,*) ' job number : ', ino1 |
---|
| 296 | ; WRITE(numout,*) ' with time step it : ', it1 |
---|
| 297 | ; WRITE(numout,*) ' with pcg option ipcg1 : ', ipcg1 |
---|
| 298 | ; WRITE(numout,*) ' with sor option isor1 : ', isor1 |
---|
| 299 | ; WRITE(numout,*) ' with tke option itke1 : ', itke1 |
---|
| 300 | ; WRITE(numout,*) ' with FETI solver option ipcg1 + isor1 : ', |
---|
| 301 | ; $ ipcg1 + isor1 |
---|
| 302 | ; WRITE(numout,*) ' ' |
---|
| 303 | ; ENDIF |
---|
| 304 | ;C |
---|
| 305 | ;C ... Control of date |
---|
| 306 | ;C |
---|
| 307 | ; IF ( (it0-it1).NE.1 .AND. abs(nrstdt).EQ.1 ) THEN |
---|
| 308 | ; IF(lwp) THEN |
---|
| 309 | ; WRITE(numout,*) ' ===>>>> : problem with nit000 for the', |
---|
| 310 | ; $ ' restart' |
---|
| 311 | ; WRITE(numout,*) ' ======= ', |
---|
| 312 | ; $ ' =======' |
---|
| 313 | ; WRITE(numout,*) ' we stop. verify the file' |
---|
| 314 | ; WRITE(numout,*) ' or rerun with the value 0 for the' |
---|
| 315 | ; WRITE(numout,*) ' control of time parameter nrstdt' |
---|
| 316 | ; WRITE(numout,*) ' ' |
---|
| 317 | ; ENDIF |
---|
| 318 | ; STOP 'dtrlec' |
---|
| 319 | ; ENDIF |
---|
| 320 | ; IF ( nrstdt.EQ.1 ) ndate0 = idast1 |
---|
| 321 | ;C |
---|
| 322 | ;C ... Read prognostic variables |
---|
| 323 | ;C |
---|
| 324 | ; CALL read3(numrst,ub ,2 ) |
---|
| 325 | ; CALL read3(numrst,vb ,3 ) |
---|
| 326 | ; CALL read3(numrst,tb ,5 ) |
---|
| 327 | ; CALL read3(numrst,sb ,6 ) |
---|
| 328 | ; CALL read3(numrst,rotb ,7 ) |
---|
| 329 | ; CALL read3(numrst,hdivb,8 ) |
---|
| 330 | ; CALL read3(numrst,un ,9 ) |
---|
| 331 | ; CALL read3(numrst,vn ,10) |
---|
| 332 | ; CALL read3(numrst,tn ,12) |
---|
| 333 | ; CALL read3(numrst,sn ,13) |
---|
| 334 | ; CALL read3(numrst,rotn ,14) |
---|
| 335 | ; CALL read3(numrst,hdivn,15) |
---|
| 336 | ;C |
---|
| 337 | ;C ... Read elliptic solver arrays |
---|
| 338 | ;C |
---|
| 339 | ; CALL read2(numrst,gcx ,jpk,17) |
---|
| 340 | ; CALL read2(numrst,gcxb,jpk,18) |
---|
| 341 | ;C |
---|
| 342 | ;#ifdef key_freesurf_cstvol |
---|
| 343 | ;C |
---|
| 344 | ;C ... free surface formulation (eta) |
---|
| 345 | ;C |
---|
| 346 | ; CALL read2(numrst,etab ,jpk,4 ) |
---|
| 347 | ; CALL read2(numrst,etan ,jpk,4 ) |
---|
| 348 | ;# else |
---|
| 349 | ;C |
---|
| 350 | ;C ... Rigid-lid formulation (bsf) |
---|
| 351 | ;C |
---|
| 352 | ; CALL read2(numrst,bsfb ,jpk,4 ) |
---|
| 353 | ; CALL read2(numrst,bsfn ,jpk,11) |
---|
| 354 | ; CALL read2(numrst,bsfd ,jpk,16) |
---|
| 355 | ;#endif |
---|
| 356 | ;C |
---|
| 357 | ;#ifdef key_zdftke |
---|
| 358 | ;C |
---|
| 359 | ;C ... Read tke arrays |
---|
| 360 | ;C |
---|
| 361 | ; IF(itke1.eq.1) THEN |
---|
| 362 | ; CALL read3(numrst,en,19) |
---|
| 363 | ; ELSE |
---|
| 364 | ; IF(lwp) THEN |
---|
| 365 | ; WRITE(numout,*) ' ===>>>> : the previous restart file', |
---|
| 366 | ; $ ' didnt used tke scheme' |
---|
| 367 | ; WRITE(numout,*) ' ======= =======' |
---|
| 368 | ; ENDIF |
---|
| 369 | ; nrstdt=2 |
---|
| 370 | ; ENDIF |
---|
| 371 | ;#endif |
---|
| 372 | ;C |
---|
| 373 | ;C |
---|
| 374 | ; RETURN |
---|
| 375 | ; END |
---|