328
329
331
332
333
334 integer, intent(in) :: ng, model
335
336
337
338 integer :: status
339 integer :: Is, Ie, i, j
340
341 real(r8) :: scale = 1.0_r8
342
343 real(r4), pointer :: A1d_4(:), A2d_4(:,:)
344 real(r8), pointer :: A1d_8(:), A2d_8(:,:)
345
346 character (len=*), parameter :: MyFile = &
347 & __FILE__//", wrt_gst_pio"
348
349 TYPE (Var_desc_t) :: pioVar
350
351 sourcefile=myfile
352
353
354
355
356
357 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
358
359
360
361 IF (master) WRITE (stdout,10) nrun+1
362
363
364
366 & nev, (/0/), (/0/), &
367 & piofile = gst(ng)%pioFile)
368 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
369
370
371
373 & ncv, (/0/), (/0/), &
374 & piofile = gst(ng)%pioFile)
375 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
376
377
378
380 & mstate(ng), (/0/), (/0/), &
381 & piofile = gst(ng)%pioFile)
382 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
383
384
385
387 & nrun, (/0/), (/0/), &
388 & piofile = gst(ng)%pioFile)
389 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
390
391
392
394 & ido(ng), (/0/), (/0/), &
395 & piofile = gst(ng)%pioFile)
396 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
397
398
399
401 & info(ng), (/0/), (/0/), &
402 & piofile = gst(ng)%pioFile)
403 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
404
405
406
408 & bmat, (/1/), (/1/), &
409 & piofile = gst(ng)%pioFile)
410 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
411
412
413
415 & which, (/1/), (/2/), &
416 & piofile = gst(ng)%pioFile)
417 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
418
419
420
422 & howmany, (/1/), (/1/), &
423 & piofile = gst(ng)%pioFile)
424 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
425
426
427
429 & ritz_tol, (/0/), (/0/), &
430 & piofile = gst(ng)%pioFile)
431 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
432
433
434
436 & iparam(:,ng), (/1/), (/SIZE(iparam)/), &
437 & piofile = gst(ng)%pioFile)
438 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
439
440
441
443 & ipntr(:,ng), (/1/), (/SIZE(ipntr)/), &
444 & piofile = gst(ng)%pioFile)
445 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
446
447
448
450 & iaupd, (/1/), (/SIZE(iaupd)/), &
451 & piofile = gst(ng)%pioFile)
452 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
453
454
455
457 & iaitr, (/1/), (/SIZE(iaitr)/), &
458 & piofile = gst(ng)%pioFile)
459 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
460
461
462
464 & iaup2, (/1/), (/SIZE(iaup2)/), &
465 & piofile = gst(ng)%pioFile)
466 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
467
468
469
471 & laitr, (/1/), (/SIZE(laitr)/), &
472 & piofile = gst(ng)%pioFile)
473 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
474
475
476
478 & laup2, (/1/), (/SIZE(laup2)/), &
479 & piofile = gst(ng)%pioFile)
480 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
481
482
483
485 & raitr, (/1/), (/SIZE(raitr)/), &
486 & piofile = gst(ng)%pioFile)
487 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
488
489
490
492 & raup2, (/1/), (/SIZE(raup2)/), &
493 & piofile = gst(ng)%pioFile)
494 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
495
496
497
498
499
500
501
502 status=pio_inq_varid(gst(ng)%pioFile, 'Bvec', piovar)
503 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
504
506 allocate ( a2d_8(nstr(ng):nend(ng),1:ncv) )
507 DO j=1,ncv
508 DO i=nstr(ng),nend(ng)
509 a2d_8(i,j)=scale*storage(ng)%Bvec(i,j)
510 END DO
511 END DO
512 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
514 & a2d_8, status)
515 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
516 deallocate (a2d_8)
517 ELSE
518 allocate ( a2d_4(nstr(ng):nend(ng),1:ncv) )
519 DO j=1,ncv
520 DO i=nstr(ng),nend(ng)
521 a2d_4(i,j)=real(scale*storage(ng)%Bvec(i,j), r4)
522 END DO
523 END DO
524 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
526 & a2d_4, status)
527 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
528 deallocate (a2d_4)
529 END IF
530
531
532
533 status=pio_inq_varid(gst(ng)%pioFile, 'resid', piovar)
534 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
535
537 allocate ( a1d_8(nstr(ng):nend(ng)) )
538 DO i=nstr(ng),nend(ng)
539 a1d_8(i)=scale*storage(ng)%resid(i)
540 END DO
541 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
543 & a1d_8, status)
544 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
545 deallocate (a1d_8)
546 ELSE
547 allocate ( a1d_4(nstr(ng):nend(ng)) )
548 DO i=nstr(ng),nend(ng)
549 a1d_4(i)=real(scale*storage(ng)%resid(i), r4)
550 END DO
551 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
553 & a1d_4, status)
554 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
555 deallocate (a1d_4)
556 END IF
557
558
559
560 is=myrank*3*nstate(ng)+1
561 ie=min(is+3*nstate(ng)-1, 3*mstate(ng))
562
563 status=pio_inq_varid(gst(ng)%pioFile, 'SworkD', piovar)
564 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
565
567 allocate ( a1d_8(is:ie) )
568 DO i=is,ie
569 a1d_8(i)=scale*storage(ng)%SworkD(i)
570 END DO
571 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
573 & a1d_8, status)
574 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
575 deallocate (a1d_8)
576 ELSE
577 allocate ( a1d_4(is:ie) )
578 DO i=is,ie
579 a1d_4(i)=real(scale*storage(ng)%SworkD(i), r4)
580 END DO
581 CALL pio_write_darray (gst(ng)%pioFile, piovar, &
583 & a1d_4, status)
584 IF (founderror(status, pio_noerr, __line__, myfile)) RETURN
585 deallocate (a1d_4)
586 END IF
587
588
589
590
592 & sworkl(:,ng), (/1/), (/lworkl/), &
593 & piofile = gst(ng)%pioFile)
594 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
595
596
597
598
599
600
602 IF (founderror(exit_flag, noerror, __line__, myfile)) RETURN
603
604 10 FORMAT (2x,'WRT_GST_PIO - writing GST checkpointing fields', &
605 & ' at iteration: ', i0)
606
607 RETURN
type(io_desc_t), dimension(:), pointer iodesc_dp_resid
type(io_desc_t), dimension(:), pointer iodesc_sp_bvec
type(io_desc_t), dimension(:), pointer iodesc_dp_bvec
subroutine, public pio_netcdf_sync(ng, model, ncname, piofile)
integer, parameter pio_frst
type(io_desc_t), dimension(:), pointer iodesc_sp_sworkd
type(io_desc_t), dimension(:), pointer iodesc_sp_resid
type(io_desc_t), dimension(:), pointer iodesc_dp_sworkd