19 #ifdef TEST_UNSTRUCTURED_FMS_IO 20 program test_unstructured_fms_io
21 #include <fms_platform.h> 22 use,
intrinsic :: iso_fortran_env, only: output_unit
37 #ifdef INTERNAL_FILE_NML 41 mpp_domains_set_stack_size, &
56 integer(INT_KIND) :: nx = 8
57 integer(INT_KIND) :: ny = 8
58 integer(INT_KIND) :: nz = 2
62 integer(INT_KIND) :: nt = 2
63 integer(INT_KIND) :: halo = 2
64 integer(INT_KIND) :: ntiles_x = 1
65 integer(INT_KIND) :: ntiles_y = 2
66 integer(INT_KIND) :: total_num_tiles
67 integer(INT_KIND),
dimension(2) :: layout(2) = (/1,1/)
68 integer(INT_KIND),
dimension(2) :: io_layout(2) = (/1,1/)
70 integer(INT_KIND) :: stackmax = 1500000
71 integer(INT_KIND) :: stackmaxd = 500000
72 logical(INT_KIND) :: debug = .false.
73 character(len=64) :: test_file =
"test_unstructured_grid" 74 character(len=64) :: iospec =
'-F cachea' 75 integer(INT_KIND) :: pack_size = 1
76 integer(INT_KIND) :: npes
77 integer(INT_KIND) :: io_status
78 real(DOUBLE_KIND) :: doubledata = 0.0
79 real :: realdata = 0.0
80 integer(INT_KIND) :: funit = 7
81 logical(INT_KIND) :: fopened
82 type(domain2D) :: structured_domain
83 type(domainUG) :: unstructured_domain
84 integer(INT_KIND) :: test_num
85 integer(INT_KIND),
parameter :: test_1_id = 1
91 namelist /test_unstructured_io_nml/ nx, &
112 #ifdef INTERNAL_FILE_NML 116 inquire(unit=funit,opened=fopened)
117 if (.not. fopened)
then 121 if (funit .eq. 100)
then 123 "test_unstructured_io: Unable to locate unit" &
124 //
" number for the input.nml file.")
127 open(unit=funit,file=
'input.nml',iostat=io_status)
128 read(funit,test_unstructured_io_nml,iostat=io_status)
133 if (io_status > 0)
then 135 "test_unstructured_io: Error reading input.nml")
142 call mpp_domains_init()
156 call mpp_set_stack_size(stackmax)
157 call mpp_domains_set_stack_size(stackmaxd)
160 if (mpp_pe() .eq. mpp_root_pe())
then 162 write(output_unit,*)
"Performing unstructured_io unit test with:" 163 write(output_unit,*)
"Total number of ranks: ", &
165 write(output_unit,*)
"Total number of grid points in the x-dimension: ", &
167 write(output_unit,*)
"Total number of grid points in the y-dimension: ", &
169 write(output_unit,*)
"Total number of grid points in the z-dimension: ", &
171 write(output_unit,*)
"Total number of grid points in the t-dimension: ", &
173 write(output_unit,*)
"Halo width (# of grid points): ", &
175 write(output_unit,*)
"Using NEW domaintypes and calls..." 179 write(test_file,
'(a,i3.3)') trim(test_file),npes
183 select case (test_num)
190 if (mpp_pe() .eq. mpp_root_pe())
then 192 write(output_unit,*)
"///////////////////////////////////////" 193 write(output_unit,*)
"Performing test 1: ..." 198 call create_mpp_domains(nx, &
207 call test_1(unstructured_domain, &
215 call destroy_mpp_domains(structured_domain, &
219 if (mpp_pe() .eq. mpp_root_pe())
then 220 write(output_unit,*)
"Test 1 complete." 221 write(output_unit,*)
"///////////////////////////////////////" 228 "test_unstructured_io: invalid test specified.")
234 call mpp_domains_exit()
241 subroutine create_mpp_domains(nx, &
245 num_domain_tiles_x, &
246 num_domain_tiles_y, &
249 use,
intrinsic :: iso_fortran_env, only: output_unit
258 mpp_define_unstruct_domain
261 integer(INT_KIND),
intent(in) :: nx
262 integer(INT_KIND),
intent(in) :: ny
263 integer(INT_KIND),
intent(in) :: nz
264 integer(INT_KIND),
intent(in) :: npes
265 integer(INT_KIND),
intent(in) :: num_domain_tiles_x
266 integer(INT_KIND),
intent(in) :: num_domain_tiles_y
267 type(domain2D),
intent(inout) :: structured_domain
268 type(domainUG),
intent(inout) :: unstructured_domain
271 integer(INT_KIND) :: num_domain_tiles
272 integer(INT_KIND) :: npes_per_domain_tile
273 integer(INT_KIND) :: my_domain_tile_id
274 logical(INT_KIND) :: is_domain_tile_root
276 integer(INT_KIND),
dimension(2) :: layout_for_full_domain
278 integer(INT_KIND),
dimension(:),
allocatable :: pe_start
279 integer(INT_KIND),
dimension(:),
allocatable :: pe_end
280 integer(INT_KIND) :: x_grid_points_per_domain_tile
281 integer(INT_KIND) :: y_grid_points_per_domain_tile
282 integer(INT_KIND),
dimension(:,:),
allocatable :: global_indices
283 integer(INT_KIND),
dimension(:,:),
allocatable :: layout2D
284 logical(INT_KIND),
dimension(:,:,:),
allocatable :: land_mask
285 integer(INT_KIND),
dimension(:),
allocatable :: num_non_masked_grid_points_per_domain_tile
286 integer(INT_KIND) :: mask_counter
287 integer(INT_KIND) :: num_non_masked_grid_points
288 integer(INT_KIND),
dimension(:),
allocatable :: num_land_tiles_per_non_masked_grid_point
289 integer(INT_KIND) :: num_ranks_using_unstructured_grid
290 integer(INT_KIND) :: io_tile_factor
291 integer(INT_KIND),
dimension(:),
allocatable :: unstructured_grid_point_index_map
292 integer(INT_KIND) :: i
293 integer(INT_KIND) :: j
294 integer(INT_KIND) :: k
295 integer(INT_KIND) :: p
298 integer(INT_KIND) :: ncontacts
299 integer(INT_KIND),
dimension(1) :: tile1
300 integer(INT_KIND),
dimension(1) :: tile2
301 integer(INT_KIND),
dimension(1) :: istart1
302 integer(INT_KIND),
dimension(1) :: iend1
303 integer(INT_KIND),
dimension(1) :: jstart1
304 integer(INT_KIND),
dimension(1) :: jend1
305 integer(INT_KIND),
dimension(1) :: istart2
306 integer(INT_KIND),
dimension(1) :: iend2
307 integer(INT_KIND),
dimension(1) :: jstart2
308 integer(INT_KIND),
dimension(1) :: jend2
311 if (mpp_pe() .eq. mpp_root_pe())
then 313 write(output_unit,*)
"Creating a structured and unstructured" &
321 if (nx .lt. 1 .or. ny .lt. 1)
then 323 "create_mpp_domains:" &
324 //
" there must be at least on grid point in the" &
325 //
" x- and y- dimensions.")
327 if (npes .gt. nx*ny)
then 329 "create_mpp_domains:" &
330 //
" the total number of ranks cannot be greater" &
331 //
" than the total number of grid points in the" &
334 if (num_domain_tiles_x .lt. 1 .or. num_domain_tiles_y .lt. 1)
then 336 "create_mpp_domains:" &
337 //
" there must be at least on domain tile in the" &
338 //
" x- and y- dimensions.")
340 if (mod(nx,num_domain_tiles_x) .ne. 0)
then 342 "create_mpp_domains:" &
343 //
" the total number of grid points in the" &
344 //
" x-dimension must be evenly divisible by the" &
345 //
" total number of domain tiles in the" &
348 if (mod(ny,num_domain_tiles_y) .ne. 0)
then 350 "create_mpp_domains:" &
351 //
" the total number of grid points in the" &
352 //
" y-dimension must be evenly divisible by the" &
353 //
" total number of domain tiles in the" &
356 if (num_domain_tiles_x*num_domain_tiles_y .gt. npes)
then 358 "create_mpp_domains:" &
359 //
" the total number of domain tiles cannot be" &
360 //
" greater than the total number of ranks.")
362 if (mod(npes,num_domain_tiles_x) .ne. 0)
then 364 "create_mpp_domains:" &
365 //
" the total number of ranks must be evenly" &
366 //
" divisible by the total number of domain" &
367 //
" tiles in the x-dimension.")
369 if (mod(npes,num_domain_tiles_y) .ne. 0)
then 371 "create_mpp_domains:" &
372 //
" the total number of ranks must be evenly" &
373 //
" divisible by the total number of domain" &
374 //
" tiles in the y-dimension.")
378 num_domain_tiles = num_domain_tiles_x*num_domain_tiles_y
379 npes_per_domain_tile = npes/num_domain_tiles
380 my_domain_tile_id = (mpp_pe())/npes_per_domain_tile + 1
381 if (mpp_pe() .eq. (my_domain_tile_id-1)*npes_per_domain_tile)
then 382 is_domain_tile_root = .true.
384 is_domain_tile_root = .false.
386 layout_for_full_domain(1) = num_domain_tiles_x
387 layout_for_full_domain(2) = npes/layout_for_full_domain(1)
393 allocate(pe_start(num_domain_tiles))
394 allocate(pe_end(num_domain_tiles))
395 do i = 1,num_domain_tiles
396 pe_start(i) = (i-1)*npes_per_domain_tile
397 pe_end(i) = i*npes_per_domain_tile - 1
402 x_grid_points_per_domain_tile = nx/num_domain_tiles_x
403 y_grid_points_per_domain_tile = ny/num_domain_tiles_y
404 allocate(global_indices(4,num_domain_tiles))
405 do i = 1,num_domain_tiles
406 global_indices(:,i) = (/1,x_grid_points_per_domain_tile, &
407 1,y_grid_points_per_domain_tile/)
409 allocate(layout2d(2,num_domain_tiles))
410 do i = 1,num_domain_tiles
411 layout2d(1,i) = layout_for_full_domain(1)/num_domain_tiles_x
412 layout2d(2,i) = layout_for_full_domain(2)/num_domain_tiles_y
431 call mpp_define_mosaic(global_indices, &
450 allocate(land_mask(x_grid_points_per_domain_tile, &
451 y_grid_points_per_domain_tile, &
453 allocate(num_non_masked_grid_points_per_domain_tile(num_domain_tiles))
455 do k = 1,num_domain_tiles
457 do j = 1,y_grid_points_per_domain_tile
458 do i = 1,x_grid_points_per_domain_tile
459 if (mod((k-1)*y_grid_points_per_domain_tile*x_grid_points_per_domain_tile + &
460 (j-1)*x_grid_points_per_domain_tile + &
461 (i-1),2) .eq. 0)
then 462 land_mask(i,j,k) = .true.
463 mask_counter = mask_counter + 1
467 num_non_masked_grid_points_per_domain_tile(k) = mask_counter
471 num_non_masked_grid_points = sum(num_non_masked_grid_points_per_domain_tile)
472 allocate(num_land_tiles_per_non_masked_grid_point(num_non_masked_grid_points))
473 num_land_tiles_per_non_masked_grid_point = 1
477 num_ranks_using_unstructured_grid = npes
478 if (num_ranks_using_unstructured_grid .gt. num_non_masked_grid_points)
then 480 "create_mpp_domains:" &
481 //
" the number of ranks exceeds the number of" &
482 //
" non-masked grid points for the unstructured" &
508 allocate(unstructured_grid_point_index_map(num_non_masked_grid_points))
510 do k = 1,num_domain_tiles
511 do j = 1,y_grid_points_per_domain_tile
512 do i = 1,x_grid_points_per_domain_tile
513 if (land_mask(i,j,k))
then 515 unstructured_grid_point_index_map(p) = (j-1)*x_grid_points_per_domain_tile + i
522 call mpp_define_unstruct_domain(unstructured_domain, &
524 num_non_masked_grid_points_per_domain_tile, &
525 num_land_tiles_per_non_masked_grid_point, &
526 num_ranks_using_unstructured_grid, &
528 unstructured_grid_point_index_map)
538 deallocate(global_indices)
540 deallocate(land_mask)
541 deallocate(num_non_masked_grid_points_per_domain_tile)
542 deallocate(num_land_tiles_per_non_masked_grid_point)
543 deallocate(unstructured_grid_point_index_map)
547 if (mpp_pe() .eq. mpp_root_pe())
then 548 write(output_unit,*)
"Domains created." 553 end subroutine create_mpp_domains
557 subroutine destroy_mpp_domains(structured_domain, &
559 use,
intrinsic :: iso_fortran_env, only: output_unit
566 mpp_deallocate_domainug
569 type(domain2D),
intent(inout) :: structured_domain
570 type(domainUG),
intent(inout) :: unstructured_domain
573 if (mpp_pe() .eq. mpp_root_pe())
then 575 write(output_unit,*)
"Creating a structured and unstructured" &
583 call mpp_deallocate_domainug(unstructured_domain)
590 if (mpp_pe() .eq. mpp_root_pe())
then 591 write(output_unit,*)
"Domains destroyed." 596 end subroutine destroy_mpp_domains
604 subroutine test_1(unstructured_domain, &
610 use,
intrinsic :: iso_fortran_env, only: output_unit
623 mpp_get_ug_io_domain, &
624 mpp_get_ug_domain_npes, &
625 mpp_get_ug_domain_pelist
634 fms_io_unstructured_save_restart, &
635 fms_io_unstructured_get_field_size, &
637 fms_io_unstructured_file_unit
640 type(domainUG),
intent(in) :: unstructured_domain
641 integer(INT_KIND),
intent(in) :: num_restarts
642 integer(INT_KIND),
intent(in) :: nx
643 integer(INT_KIND),
intent(in) :: ny
644 integer(INT_KIND),
intent(in) :: nz
645 integer(INT_KIND),
intent(in) :: npes
648 type(domainUG),
pointer :: io_domain
649 integer(INT_KIND) :: io_domain_npes
650 integer(INT_KIND),
dimension(:),
allocatable :: pelist
651 character(len=256) :: restart_file_name
652 real,
dimension(:),
allocatable :: x_axis_data
653 real,
dimension(:),
allocatable :: y_axis_data
654 real,
dimension(:),
allocatable :: z_axis_data
655 integer(INT_KIND) :: cc_axis_size
656 real,
dimension(:),
allocatable :: cc_axis_data
657 integer(INT_KIND) :: compressed_c_axis_size
658 integer(INT_KIND),
dimension(:),
allocatable :: compressed_c_axis_data
659 integer(INT_KIND) :: compressed_h_axis_size
660 integer(INT_KIND),
dimension(:),
allocatable :: compressed_h_axis_data
661 integer(INT_KIND),
dimension(:),
allocatable :: compressed_c_axis_size_per_rank
662 integer(INT_KIND),
dimension(:),
allocatable :: compressed_h_axis_size_per_rank
663 type(restart_file_type) :: restart_file
664 integer(INT_KIND) :: register_id
665 character(len=256) :: real_scalar_field_name
666 real :: real_scalar_field_data
667 character(len=256) :: compressed_c_real_1D_field_name
668 real,
dimension(:),
allocatable :: compressed_c_real_1D_field_data
669 character(len=256) :: compressed_h_real_1D_field_name
670 real,
dimension(:),
allocatable :: compressed_h_real_1D_field_data
671 character(len=256) :: compressed_c_z_real_2D_field_name
672 real,
dimension(:,:),
allocatable :: compressed_c_z_real_2D_field_data
673 character(len=256) :: compressed_h_z_real_2D_field_name
674 real,
dimension(:,:),
allocatable :: compressed_h_z_real_2D_field_data
675 character(len=256) :: compressed_c_cc_real_2D_field_name
676 real,
dimension(:,:),
allocatable :: compressed_c_cc_real_2D_field_data
677 character(len=256) :: compressed_h_cc_real_2D_field_name
678 real,
dimension(:,:),
allocatable :: compressed_h_cc_real_2D_field_data
679 character(len=256) :: compressed_c_z_cc_real_3D_field_name
680 real,
dimension(:,:,:),
allocatable :: compressed_c_z_cc_real_3D_field_data
681 character(len=256) :: compressed_h_z_cc_real_3D_field_name
682 real,
dimension(:,:,:),
allocatable :: compressed_h_z_cc_real_3D_field_data
683 character(len=256) :: compressed_c_cc_z_real_3D_field_name
684 real,
dimension(:,:,:),
allocatable :: compressed_c_cc_z_real_3D_field_data
685 character(len=256) :: compressed_h_cc_z_real_3D_field_name
686 real,
dimension(:,:,:),
allocatable :: compressed_h_cc_z_real_3D_field_data
687 character(len=256) :: int_scalar_field_name
688 integer :: int_scalar_field_data
689 character(len=256) :: compressed_c_int_1D_field_name
690 integer,
dimension(:),
allocatable :: compressed_c_int_1D_field_data
691 character(len=256) :: compressed_h_int_1D_field_name
692 integer,
dimension(:),
allocatable :: compressed_h_int_1D_field_data
693 character(len=256) :: compressed_c_z_int_2D_field_name
694 integer,
dimension(:,:),
allocatable :: compressed_c_z_int_2D_field_data
695 character(len=256) :: compressed_h_z_int_2D_field_name
696 integer,
dimension(:,:),
allocatable :: compressed_h_z_int_2D_field_data
697 character(len=256) :: compressed_c_cc_int_2D_field_name
698 integer,
dimension(:,:),
allocatable :: compressed_c_cc_int_2D_field_data
699 character(len=256) :: compressed_h_cc_int_2D_field_name
700 integer,
dimension(:,:),
allocatable :: compressed_h_cc_int_2D_field_data
701 real,
dimension(:),
allocatable :: real_scalar_field_data_ref
702 real,
dimension(:,:),
allocatable :: compressed_c_real_1D_field_data_ref
703 real,
dimension(:,:),
allocatable :: compressed_h_real_1D_field_data_ref
704 real,
dimension(:,:,:),
allocatable :: compressed_c_z_real_2D_field_data_ref
705 real,
dimension(:,:,:),
allocatable :: compressed_h_z_real_2D_field_data_ref
706 real,
dimension(:,:,:),
allocatable :: compressed_c_cc_real_2D_field_data_ref
707 real,
dimension(:,:,:),
allocatable :: compressed_h_cc_real_2D_field_data_ref
708 real,
dimension(:,:,:,:),
allocatable :: compressed_c_z_cc_real_3D_field_data_ref
709 real,
dimension(:,:,:,:),
allocatable :: compressed_h_z_cc_real_3D_field_data_ref
710 real,
dimension(:,:,:,:),
allocatable :: compressed_c_cc_z_real_3D_field_data_ref
711 real,
dimension(:,:,:,:),
allocatable :: compressed_h_cc_z_real_3D_field_data_ref
712 integer,
dimension(:),
allocatable :: int_scalar_field_data_ref
713 integer,
dimension(:,:),
allocatable :: compressed_c_int_1D_field_data_ref
714 integer,
dimension(:,:),
allocatable :: compressed_h_int_1D_field_data_ref
715 integer,
dimension(:,:,:),
allocatable :: compressed_c_z_int_2D_field_data_ref
716 integer,
dimension(:,:,:),
allocatable :: compressed_h_z_int_2D_field_data_ref
717 integer,
dimension(:,:,:),
allocatable :: compressed_c_cc_int_2D_field_data_ref
718 integer,
dimension(:,:,:),
allocatable :: compressed_h_cc_int_2D_field_data_ref
719 integer(INT_KIND),
dimension(5) :: field_dimension_sizes
720 logical(INT_KIND) :: field_found_in_file
721 real,
dimension(:),
allocatable :: real_buffer_1D
722 real,
dimension(:,:),
allocatable :: real_buffer_2D
723 real,
dimension(:,:,:),
allocatable :: real_buffer_3D
724 integer,
dimension(:),
allocatable :: int_buffer_1D
725 integer,
dimension(:,:),
allocatable :: int_buffer_2D
726 integer(INT_KIND) :: offset
728 integer :: imax_error
729 integer(LONG_KIND) :: read_in_chksum
730 integer(LONG_KIND) :: ref_chksum
731 integer(INT_KIND) :: funit
732 integer(INT_KIND) :: i
733 integer(INT_KIND) :: j
734 integer(INT_KIND) :: k
735 integer(INT_KIND) :: q
738 if (mpp_pe() .eq. mpp_root_pe())
then 740 write(output_unit,*)
"Executing test 1 body ..." 745 if (num_restarts .gt. 10)
then 747 "test 1: the inputted number of restarts should" &
748 //
" be less than or equal to 10.")
756 io_domain => mpp_get_ug_io_domain(unstructured_domain)
757 io_domain_npes = mpp_get_ug_domain_npes(io_domain)
758 allocate(pelist(io_domain_npes))
759 call mpp_get_ug_domain_pelist(io_domain, &
764 restart_file_name =
"test_1_unstructured_restart_file.nc" 768 allocate(x_axis_data(nx))
770 x_axis_data(i) = (
real(i-1))*(360.0/
real(nx))
781 allocate(y_axis_data(ny))
783 y_axis_data(i) = (
real(i-1))*(180.0/
real(ny))
794 allocate(z_axis_data(nz))
796 z_axis_data(i) =
real(i*5.0)
808 allocate(cc_axis_data(cc_axis_size))
809 do i = 1,cc_axis_size
810 cc_axis_data(i) =
real(i)*12.0 -
real(i)
823 compressed_c_axis_size = mpp_pe() + 1
824 allocate(compressed_c_axis_data(compressed_c_axis_size))
825 do i = 1,compressed_c_axis_size
826 compressed_c_axis_data(i) =
real(mpp_pe()*mpp_pe() + i)
830 "compressed_c_axis", &
831 compressed_c_axis_data, &
834 compressed_c_axis_size, &
836 allocate(compressed_c_axis_size_per_rank(io_domain_npes))
837 compressed_c_axis_size_per_rank = 0
838 do i = 1,io_domain_npes
839 if (pelist(i) .ne. mpp_pe())
then 840 call mpp_recv(compressed_c_axis_size_per_rank(i), &
844 call mpp_send(compressed_c_axis_size, &
848 compressed_c_axis_size_per_rank(i) = compressed_c_axis_size
857 compressed_h_axis_size = npes
858 allocate(compressed_h_axis_data(compressed_h_axis_size))
859 do i = 1,compressed_h_axis_size
860 compressed_h_axis_data(i) =
real((mpp_pe())*npes + i)
864 "compressed_h_axis", &
865 compressed_h_axis_data, &
868 compressed_h_axis_size, &
870 allocate(compressed_h_axis_size_per_rank(io_domain_npes))
871 compressed_h_axis_size_per_rank = 0
872 do i = 1,io_domain_npes
873 if (pelist(i) .ne. mpp_pe())
then 874 call mpp_recv(compressed_h_axis_size_per_rank(i), &
878 call mpp_send(compressed_h_axis_size, &
882 compressed_h_axis_size_per_rank(i) = compressed_h_axis_size
893 real_scalar_field_name =
"real_scalar_field_1" 894 real_scalar_field_data = 1234.5678
898 real_scalar_field_name, &
899 real_scalar_field_data, &
900 unstructured_domain, &
907 compressed_c_real_1d_field_name =
"compressed_c_real_1D_field_1" 908 allocate(compressed_c_real_1d_field_data(compressed_c_axis_size))
909 do i = 1,compressed_c_axis_size
910 compressed_c_real_1d_field_data(i) =
real(mpp_pe())
914 compressed_c_real_1d_field_name, &
915 compressed_c_real_1d_field_data, &
917 unstructured_domain, &
918 longname=
"r1Dcompcf1", &
924 compressed_h_real_1d_field_name =
"compressed_h_real_1D_field_1" 925 allocate(compressed_h_real_1d_field_data(compressed_h_axis_size))
926 do i = 1,compressed_h_axis_size
927 compressed_h_real_1d_field_data(i) =
real(i) +
real(mpp_pe()) &
932 compressed_h_real_1d_field_name, &
933 compressed_h_real_1d_field_data, &
935 unstructured_domain, &
936 longname=
"r1Dcomphf1", &
942 compressed_c_z_real_2d_field_name =
"compressed_c_z_real_2D_field_1" 943 allocate(compressed_c_z_real_2d_field_data(compressed_c_axis_size,nz))
945 do i = 1,compressed_c_axis_size
946 compressed_c_z_real_2d_field_data(i,j) =
real(mpp_pe()*1000) &
953 compressed_c_z_real_2d_field_name, &
954 compressed_c_z_real_2d_field_data, &
956 unstructured_domain, &
957 longname=
"r2Dcompczf1", &
963 compressed_h_z_real_2d_field_name =
"compressed_h_z_real_2D_field_1" 964 allocate(compressed_h_z_real_2d_field_data(compressed_h_axis_size,nz))
966 do i = 1,compressed_h_axis_size
967 compressed_h_z_real_2d_field_data(i,j) =
real(mpp_pe()*1000) &
968 - 1.0*
real((j-1)* &
compressed_h_axis_size+i) &
974 compressed_h_z_real_2d_field_name, &
975 compressed_h_z_real_2d_field_data, &
977 unstructured_domain, &
978 longname=
"r2Dcomphzf1", &
984 compressed_c_cc_real_2d_field_name =
"compressed_c_cc_real_2D_field_1" 985 allocate(compressed_c_cc_real_2d_field_data(compressed_c_axis_size, &
987 do j = 1,cc_axis_size
988 do i = 1,compressed_c_axis_size
989 compressed_c_cc_real_2d_field_data(i,j) =
real(mpp_pe()*1111) &
996 compressed_c_cc_real_2d_field_name, &
997 compressed_c_cc_real_2d_field_data, &
999 unstructured_domain, &
1000 longname=
"r2Dcompcccf1", &
1006 compressed_h_cc_real_2d_field_name =
"compressed_h_cc_real_2D_field_1" 1007 allocate(compressed_h_cc_real_2d_field_data(compressed_h_axis_size, &
1009 do j = 1,cc_axis_size
1010 do i = 1,compressed_h_axis_size
1011 compressed_h_cc_real_2d_field_data(i,j) =
real(mpp_pe()*1111) &
1012 - 5.0*
real((j-1)* &
compressed_h_axis_size+i) &
1017 restart_file_name, &
1018 compressed_h_cc_real_2d_field_name, &
1019 compressed_h_cc_real_2d_field_data, &
1021 unstructured_domain, &
1022 longname=
"r2Dcomphccf1", &
1028 compressed_c_z_cc_real_3d_field_name =
"compressed_c_z_cc_real_3D_field_1" 1029 allocate(compressed_c_z_cc_real_3d_field_data(compressed_c_axis_size, &
1032 do k = 1,cc_axis_size
1034 do i = 1,compressed_c_axis_size
1035 compressed_c_z_cc_real_3d_field_data(i,j,k) =
real(mpp_pe()*10000) &
1043 restart_file_name, &
1044 compressed_c_z_cc_real_3d_field_name, &
1045 compressed_c_z_cc_real_3d_field_data, &
1047 unstructured_domain, &
1048 longname=
"r3Dcompczccf1", &
1054 compressed_h_z_cc_real_3d_field_name =
"compressed_h_z_cc_real_3D_field_1" 1055 allocate(compressed_h_z_cc_real_3d_field_data(compressed_h_axis_size, &
1058 do k = 1,cc_axis_size
1060 do i = 1,compressed_h_axis_size
1061 compressed_h_z_cc_real_3d_field_data(i,j,k) =
real(mpp_pe()*1000) &
1062 - 1.0*
real((j-1)* &
compressed_h_axis_size+i) &
1063 + 2.2222222*(
real(k-mpp_pe()))
1068 restart_file_name, &
1069 compressed_h_z_cc_real_3d_field_name, &
1070 compressed_h_z_cc_real_3d_field_data, &
1072 unstructured_domain, &
1073 longname=
"r3Dcomphzccf1", &
1079 compressed_c_cc_z_real_3d_field_name =
"compressed_c_cc_z_real_3D_field_1" 1080 allocate(compressed_c_cc_z_real_3d_field_data(compressed_c_axis_size, &
1084 do j = 1,cc_axis_size
1085 do i = 1,compressed_c_axis_size
1086 compressed_c_cc_z_real_3d_field_data(i,j,k) =
real(mpp_pe()*11111) &
1094 restart_file_name, &
1095 compressed_c_cc_z_real_3d_field_name, &
1096 compressed_c_cc_z_real_3d_field_data, &
1098 unstructured_domain, &
1099 longname=
"r3Dcompccczf1", &
1105 compressed_h_cc_z_real_3d_field_name =
"compressed_h_cc_z_real_3D_field_1" 1106 allocate(compressed_h_cc_z_real_3d_field_data(compressed_h_axis_size, &
1110 do j = 1,cc_axis_size
1111 do i = 1,compressed_h_axis_size
1112 compressed_h_cc_z_real_3d_field_data(i,j,k) =
real(mpp_pe()*11111) &
1113 - 1.0*
real((j-1)* &
compressed_h_axis_size+i) &
1114 + 2.2222222*(
real(k-mpp_pe()))
1119 restart_file_name, &
1120 compressed_h_cc_z_real_3d_field_name, &
1121 compressed_h_cc_z_real_3d_field_data, &
1123 unstructured_domain, &
1124 longname=
"r3Dcomphcczf1", &
1131 int_scalar_field_name =
"int_scalar_field_1" 1132 int_scalar_field_data = 4321
1135 restart_file_name, &
1136 int_scalar_field_name, &
1137 int_scalar_field_data, &
1138 unstructured_domain, &
1145 compressed_c_int_1d_field_name =
"compressed_c_int_1D_field_1" 1146 allocate(compressed_c_int_1d_field_data(compressed_c_axis_size))
1147 do i = 1,compressed_c_axis_size
1148 compressed_c_int_1d_field_data(i) = mpp_pe()
1151 restart_file_name, &
1152 compressed_c_int_1d_field_name, &
1153 compressed_c_int_1d_field_data, &
1155 unstructured_domain, &
1156 longname=
"i1Dcompcf1", &
1162 compressed_h_int_1d_field_name =
"compressed_h_int_1D_field_1" 1163 allocate(compressed_h_int_1d_field_data(compressed_h_axis_size))
1164 do i = 1,compressed_h_axis_size
1165 compressed_h_int_1d_field_data(i) = i + mpp_pe() + 1111
1168 restart_file_name, &
1169 compressed_h_int_1d_field_name, &
1170 compressed_h_int_1d_field_data, &
1172 unstructured_domain, &
1173 longname=
"i1Dcomphf1", &
1179 compressed_c_z_int_2d_field_name =
"compressed_c_z_int_2D_field_1" 1180 allocate(compressed_c_z_int_2d_field_data(compressed_c_axis_size,nz))
1182 do i = 1,compressed_c_axis_size
1183 compressed_c_z_int_2d_field_data(i,j) = mpp_pe()*1000 &
1188 restart_file_name, &
1189 compressed_c_z_int_2d_field_name, &
1190 compressed_c_z_int_2d_field_data, &
1192 unstructured_domain, &
1193 longname=
"i2Dcompczf1", &
1199 compressed_h_z_int_2d_field_name =
"compressed_h_z_int_2D_field_1" 1200 allocate(compressed_h_z_int_2d_field_data(compressed_h_axis_size,nz))
1202 do i = 1,compressed_h_axis_size
1203 compressed_h_z_int_2d_field_data(i,j) = mpp_pe()*1000 &
1205 compressed_h_axis_size+i &
1210 restart_file_name, &
1211 compressed_h_z_int_2d_field_name, &
1212 compressed_h_z_int_2d_field_data, &
1214 unstructured_domain, &
1215 longname=
"i2Dcomphzf1", &
1221 compressed_c_cc_int_2d_field_name =
"compressed_c_cc_int_2D_field_1" 1222 allocate(compressed_c_cc_int_2d_field_data(compressed_c_axis_size, &
1224 do j = 1,cc_axis_size
1225 do i = 1,compressed_c_axis_size
1226 compressed_c_cc_int_2d_field_data(i,j) = mpp_pe()*1111 &
1231 restart_file_name, &
1232 compressed_c_cc_int_2d_field_name, &
1233 compressed_c_cc_int_2d_field_data, &
1235 unstructured_domain, &
1236 longname=
"i2Dcompcccf1", &
1242 compressed_h_cc_int_2d_field_name =
"compressed_h_cc_int_2D_field_1" 1243 allocate(compressed_h_cc_int_2d_field_data(compressed_h_axis_size, &
1245 do j = 1,cc_axis_size
1246 do i = 1,compressed_h_axis_size
1247 compressed_h_cc_int_2d_field_data(i,j) = mpp_pe()*1111 &
1249 compressed_h_axis_size+i &
1254 restart_file_name, &
1255 compressed_h_cc_int_2d_field_name, &
1256 compressed_h_cc_int_2d_field_data, &
1258 unstructured_domain, &
1259 longname=
"i2Dcomphccf1", &
1263 allocate(real_scalar_field_data_ref(num_restarts))
1264 allocate(compressed_c_real_1d_field_data_ref(compressed_c_axis_size,num_restarts))
1265 allocate(compressed_h_real_1d_field_data_ref(compressed_h_axis_size,num_restarts))
1266 allocate(compressed_c_z_real_2d_field_data_ref(compressed_c_axis_size,nz,num_restarts))
1267 allocate(compressed_h_z_real_2d_field_data_ref(compressed_h_axis_size,nz,num_restarts))
1268 allocate(compressed_c_cc_real_2d_field_data_ref(compressed_c_axis_size,cc_axis_size,num_restarts))
1269 allocate(compressed_h_cc_real_2d_field_data_ref(compressed_h_axis_size,cc_axis_size,num_restarts))
1270 allocate(compressed_c_z_cc_real_3d_field_data_ref(compressed_c_axis_size,nz,cc_axis_size,num_restarts))
1271 allocate(compressed_h_z_cc_real_3d_field_data_ref(compressed_h_axis_size,nz,cc_axis_size,num_restarts))
1272 allocate(compressed_c_cc_z_real_3d_field_data_ref(compressed_c_axis_size,cc_axis_size,nz,num_restarts))
1273 allocate(compressed_h_cc_z_real_3d_field_data_ref(compressed_h_axis_size,cc_axis_size,nz,num_restarts))
1274 allocate(int_scalar_field_data_ref(num_restarts))
1275 allocate(compressed_c_int_1d_field_data_ref(compressed_c_axis_size,num_restarts))
1276 allocate(compressed_h_int_1d_field_data_ref(compressed_h_axis_size,num_restarts))
1277 allocate(compressed_c_z_int_2d_field_data_ref(compressed_c_axis_size,nz,num_restarts))
1278 allocate(compressed_h_z_int_2d_field_data_ref(compressed_h_axis_size,nz,num_restarts))
1279 allocate(compressed_c_cc_int_2d_field_data_ref(compressed_c_axis_size,cc_axis_size,num_restarts))
1280 allocate(compressed_h_cc_int_2d_field_data_ref(compressed_h_axis_size,cc_axis_size,num_restarts))
1284 do q = 1,num_restarts
1288 real_scalar_field_data = real_scalar_field_data + 8.0
1289 compressed_c_real_1d_field_data = compressed_c_real_1d_field_data + 9.0
1290 compressed_h_real_1d_field_data = compressed_h_real_1d_field_data + 10.0
1291 compressed_c_z_real_2d_field_data = compressed_c_z_real_2d_field_data + 11.0
1292 compressed_h_z_real_2d_field_data = compressed_h_z_real_2d_field_data + 12.0
1293 compressed_c_cc_real_2d_field_data = compressed_c_cc_real_2d_field_data + 13.0
1294 compressed_h_cc_real_2d_field_data = compressed_h_cc_real_2d_field_data + 14.0
1295 compressed_c_z_cc_real_3d_field_data = compressed_c_z_cc_real_3d_field_data + 15.0
1296 compressed_h_z_cc_real_3d_field_data = compressed_h_z_cc_real_3d_field_data + 16.0
1297 compressed_c_cc_z_real_3d_field_data = compressed_c_cc_z_real_3d_field_data + 17.0
1298 compressed_h_cc_z_real_3d_field_data = compressed_h_cc_z_real_3d_field_data + 18.0
1299 int_scalar_field_data = int_scalar_field_data + 19
1300 compressed_c_int_1d_field_data = compressed_c_int_1d_field_data + 20
1301 compressed_h_int_1d_field_data = compressed_h_int_1d_field_data + 21
1302 compressed_c_z_int_2d_field_data = compressed_c_z_int_2d_field_data + 22
1303 compressed_h_z_int_2d_field_data = compressed_h_z_int_2d_field_data + 23
1304 compressed_c_cc_int_2d_field_data = compressed_c_cc_int_2d_field_data + 24
1305 compressed_h_cc_int_2d_field_data = compressed_h_cc_int_2d_field_data + 25
1309 real_scalar_field_data_ref(q) = real_scalar_field_data
1310 compressed_c_real_1d_field_data_ref(:,q) = compressed_c_real_1d_field_data
1311 compressed_h_real_1d_field_data_ref(:,q) = compressed_h_real_1d_field_data
1312 compressed_c_z_real_2d_field_data_ref(:,:,q) = compressed_c_z_real_2d_field_data
1313 compressed_h_z_real_2d_field_data_ref(:,:,q) = compressed_h_z_real_2d_field_data
1314 compressed_c_cc_real_2d_field_data_ref(:,:,q) = compressed_c_cc_real_2d_field_data
1315 compressed_h_cc_real_2d_field_data_ref(:,:,q) = compressed_h_cc_real_2d_field_data
1316 compressed_c_z_cc_real_3d_field_data_ref(:,:,:,q) = compressed_c_z_cc_real_3d_field_data
1317 compressed_h_z_cc_real_3d_field_data_ref(:,:,:,q) = compressed_h_z_cc_real_3d_field_data
1318 compressed_c_cc_z_real_3d_field_data_ref(:,:,:,q) = compressed_c_cc_z_real_3d_field_data
1319 compressed_h_cc_z_real_3d_field_data_ref(:,:,:,q) = compressed_h_cc_z_real_3d_field_data
1320 int_scalar_field_data_ref(q) = int_scalar_field_data
1321 compressed_c_int_1d_field_data_ref(:,q) = compressed_c_int_1d_field_data
1322 compressed_h_int_1d_field_data_ref(:,q) = compressed_h_int_1d_field_data
1323 compressed_c_z_int_2d_field_data_ref(:,:,q) = compressed_c_z_int_2d_field_data
1324 compressed_h_z_int_2d_field_data_ref(:,:,q) = compressed_h_z_int_2d_field_data
1325 compressed_c_cc_int_2d_field_data_ref(:,:,q) = compressed_c_cc_int_2d_field_data
1326 compressed_h_cc_int_2d_field_data_ref(:,:,q) = compressed_h_cc_int_2d_field_data
1331 call fms_io_unstructured_save_restart(restart_file, &
1332 directory=
"RESTART", &
1336 call fms_io_unstructured_save_restart(restart_file, &
1337 directory=
"RESTART")
1344 do q = 1,num_restarts
1348 if (mpp_pe() .eq. mpp_root_pe())
then 1349 write(output_unit,*)
1350 write(output_unit,*)
"Checking restart data at timelevel:",q
1355 real_scalar_field_data = 0.0
1356 compressed_c_real_1d_field_data = 0.0
1357 compressed_h_real_1d_field_data = 0.0
1358 compressed_c_z_real_2d_field_data = 0.0
1359 compressed_h_z_real_2d_field_data = 0.0
1360 compressed_c_cc_real_2d_field_data = 0.0
1361 compressed_h_cc_real_2d_field_data = 0.0
1362 compressed_c_z_cc_real_3d_field_data = 0.0
1363 compressed_h_z_cc_real_3d_field_data = 0.0
1364 compressed_c_cc_z_real_3d_field_data = 0.0
1365 compressed_h_cc_z_real_3d_field_data = 0.0
1366 int_scalar_field_data = 0
1367 compressed_c_int_1d_field_data = 0
1368 compressed_h_int_1d_field_data = 0
1369 compressed_c_z_int_2d_field_data = 0
1370 compressed_h_z_int_2d_field_data = 0
1371 compressed_c_cc_int_2d_field_data = 0
1372 compressed_h_cc_int_2d_field_data = 0
1382 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1383 real_scalar_field_name, &
1384 field_dimension_sizes, &
1385 unstructured_domain, &
1386 field_found_in_file)
1387 if (.not. field_found_in_file)
then 1389 "test 1: field "//trim(real_scalar_field_name) &
1390 //
" was not found in file " &
1391 //trim(restart_file_name))
1393 allocate(real_buffer_1d(1))
1395 real_scalar_field_name, &
1397 unstructured_domain, &
1399 real_scalar_field_data = real_buffer_1d(1)
1400 deallocate(real_buffer_1d)
1401 rmax_error = abs(real_scalar_field_data - &
1402 real_scalar_field_data_ref(q))
1403 if (rmax_error .ne. 0.0)
then 1404 write(output_unit,*)
1405 write(output_unit,*)
"My rank: ",mpp_pe()
1406 write(output_unit,*)
"Restart iteration: ",q
1407 write(output_unit,*)
"Max real scalar field error: ",rmax_error
1409 "test 1: real scalar field data incorrect.")
1411 if (mpp_pe() .eq. mpp_root_pe())
then 1412 write(output_unit,*)
1413 write(output_unit,*)
"Real scalar field data correct." 1421 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1422 compressed_c_real_1d_field_name, &
1423 field_dimension_sizes, &
1424 unstructured_domain, &
1425 field_found_in_file)
1426 if (.not. field_found_in_file)
then 1428 "test 1: field "//trim(compressed_c_real_1d_field_name) &
1429 //
" was not found in file " &
1430 //trim(restart_file_name))
1432 allocate(real_buffer_1d(field_dimension_sizes(1)))
1434 compressed_c_real_1d_field_name, &
1436 unstructured_domain, &
1438 if (mpp_pe() .eq. pelist(1))
then 1442 do i = 1,io_domain_npes
1443 if (mpp_pe() .eq. pelist(i))
then 1446 offset = offset + compressed_c_axis_size_per_rank(i)
1450 do i = 1,compressed_c_axis_size
1451 compressed_c_real_1d_field_data(i) = real_buffer_1d(i+offset)
1453 deallocate(real_buffer_1d)
1454 rmax_error = maxval(abs(compressed_c_real_1d_field_data - &
1455 compressed_c_real_1d_field_data_ref(:,q)))
1456 read_in_chksum =
mpp_chksum(compressed_c_real_1d_field_data)
1457 ref_chksum =
mpp_chksum(compressed_c_real_1d_field_data_ref(:,q))
1458 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1459 write(output_unit,*)
1460 write(output_unit,*)
"My rank: ",mpp_pe()
1461 write(output_unit,*)
"Restart iteration: ",q
1462 write(output_unit,*)
"Max compressed c real 1D field error: ",rmax_error
1463 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1464 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1466 "test 1: compressed c real 1D field data incorrect.")
1468 if (mpp_pe() .eq. mpp_root_pe())
then 1469 write(output_unit,*)
1470 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1471 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1472 write(output_unit,*)
"Compressed c real 1D field data correct." 1480 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1481 compressed_h_real_1d_field_name, &
1482 field_dimension_sizes, &
1483 unstructured_domain, &
1484 field_found_in_file)
1485 if (.not. field_found_in_file)
then 1487 "test 1: field "//trim(compressed_h_real_1d_field_name) &
1488 //
" was not found in file " &
1489 //trim(restart_file_name))
1491 allocate(real_buffer_1d(field_dimension_sizes(1)))
1493 compressed_h_real_1d_field_name, &
1495 unstructured_domain, &
1497 if (mpp_pe() .eq. pelist(1))
then 1501 do i = 1,io_domain_npes
1502 if (mpp_pe() .eq. pelist(i))
then 1505 offset = offset + compressed_h_axis_size_per_rank(i)
1509 do i = 1,compressed_h_axis_size
1510 compressed_h_real_1d_field_data(i) = real_buffer_1d(i+offset)
1512 deallocate(real_buffer_1d)
1513 rmax_error = maxval(abs(compressed_h_real_1d_field_data - &
1514 compressed_h_real_1d_field_data_ref(:,q)))
1515 read_in_chksum =
mpp_chksum(compressed_h_real_1d_field_data)
1516 ref_chksum =
mpp_chksum(compressed_h_real_1d_field_data_ref(:,q))
1517 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1518 write(output_unit,*)
1519 write(output_unit,*)
"My rank: ",mpp_pe()
1520 write(output_unit,*)
"Restart iteration: ",q
1521 write(output_unit,*)
"Max compressed h real 1D field error: ",rmax_error
1522 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1523 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1525 "test 1: compressed h real 1D field data incorrect.")
1527 if (mpp_pe() .eq. mpp_root_pe())
then 1528 write(output_unit,*)
1529 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1530 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1531 write(output_unit,*)
"Compressed h real 1D field data correct." 1539 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1540 compressed_c_z_real_2d_field_name, &
1541 field_dimension_sizes, &
1542 unstructured_domain, &
1543 field_found_in_file)
1544 if (.not. field_found_in_file)
then 1546 "test 1: field "//trim(compressed_c_z_real_2d_field_name) &
1547 //
" was not found in file " &
1548 //trim(restart_file_name))
1550 allocate(real_buffer_2d(field_dimension_sizes(1), &
1551 field_dimension_sizes(2)))
1553 compressed_c_z_real_2d_field_name, &
1555 unstructured_domain, &
1557 if (mpp_pe() .eq. pelist(1))
then 1561 do i = 1,io_domain_npes
1562 if (mpp_pe() .eq. pelist(i))
then 1565 offset = offset + compressed_c_axis_size_per_rank(i)
1569 do j = 1,
size(compressed_c_z_real_2d_field_data,2)
1570 do i = 1,
size(compressed_c_z_real_2d_field_data,1)
1571 compressed_c_z_real_2d_field_data(i,j) = real_buffer_2d(i+offset,j)
1574 deallocate(real_buffer_2d)
1575 rmax_error = maxval(abs(compressed_c_z_real_2d_field_data - &
1576 compressed_c_z_real_2d_field_data_ref(:,:,q)))
1577 read_in_chksum =
mpp_chksum(compressed_c_z_real_2d_field_data)
1578 ref_chksum =
mpp_chksum(compressed_c_z_real_2d_field_data_ref(:,:,q))
1579 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1580 write(output_unit,*)
1581 write(output_unit,*)
"My rank: ",mpp_pe()
1582 write(output_unit,*)
"Restart iteration: ",q
1583 write(output_unit,*)
"Max compressed c, z real 2D field error: ",rmax_error
1584 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1585 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1587 "test 1: compressed c, z real 2D field data incorrect.")
1589 if (mpp_pe() .eq. mpp_root_pe())
then 1590 write(output_unit,*)
1591 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1592 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1593 write(output_unit,*)
"Compressed c, z real 2D field data correct." 1601 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1602 compressed_h_z_real_2d_field_name, &
1603 field_dimension_sizes, &
1604 unstructured_domain, &
1605 field_found_in_file)
1606 if (.not. field_found_in_file)
then 1608 "test 1: field "//trim(compressed_h_z_real_2d_field_name) &
1609 //
" was not found in file " &
1610 //trim(restart_file_name))
1612 allocate(real_buffer_2d(field_dimension_sizes(1), &
1613 field_dimension_sizes(2)))
1615 compressed_h_z_real_2d_field_name, &
1617 unstructured_domain, &
1619 if (mpp_pe() .eq. pelist(1))
then 1623 do i = 1,io_domain_npes
1624 if (mpp_pe() .eq. pelist(i))
then 1627 offset = offset + compressed_h_axis_size_per_rank(i)
1631 do j = 1,
size(compressed_h_z_real_2d_field_data,2)
1632 do i = 1,
size(compressed_h_z_real_2d_field_data,1)
1633 compressed_h_z_real_2d_field_data(i,j) = real_buffer_2d(i+offset,j)
1636 deallocate(real_buffer_2d)
1637 rmax_error = maxval(abs(compressed_h_z_real_2d_field_data - &
1638 compressed_h_z_real_2d_field_data_ref(:,:,q)))
1639 read_in_chksum =
mpp_chksum(compressed_h_z_real_2d_field_data)
1640 ref_chksum =
mpp_chksum(compressed_h_z_real_2d_field_data_ref(:,:,q))
1641 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1642 write(output_unit,*)
1643 write(output_unit,*)
"My rank: ",mpp_pe()
1644 write(output_unit,*)
"Restart iteration: ",q
1645 write(output_unit,*)
"Max compressed h, z real 2D field error: ",rmax_error
1646 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1647 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1649 "test 1: compressed h, z real 2D field data incorrect.")
1651 if (mpp_pe() .eq. mpp_root_pe())
then 1652 write(output_unit,*)
1653 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1654 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1655 write(output_unit,*)
"Compressed h, z real 2D field data correct." 1663 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1664 compressed_c_cc_real_2d_field_name, &
1665 field_dimension_sizes, &
1666 unstructured_domain, &
1667 field_found_in_file)
1668 if (.not. field_found_in_file)
then 1670 "test 1: field "//trim(compressed_c_cc_real_2d_field_name) &
1671 //
" was not found in file " &
1672 //trim(restart_file_name))
1674 allocate(real_buffer_2d(field_dimension_sizes(1), &
1675 field_dimension_sizes(2)))
1677 compressed_c_cc_real_2d_field_name, &
1679 unstructured_domain, &
1681 if (mpp_pe() .eq. pelist(1))
then 1685 do i = 1,io_domain_npes
1686 if (mpp_pe() .eq. pelist(i))
then 1689 offset = offset + compressed_c_axis_size_per_rank(i)
1693 do j = 1,
size(compressed_c_cc_real_2d_field_data,2)
1694 do i = 1,
size(compressed_c_cc_real_2d_field_data,1)
1695 compressed_c_cc_real_2d_field_data(i,j) = real_buffer_2d(i+offset,j)
1698 deallocate(real_buffer_2d)
1699 rmax_error = maxval(abs(compressed_c_cc_real_2d_field_data - &
1700 compressed_c_cc_real_2d_field_data_ref(:,:,q)))
1701 read_in_chksum =
mpp_chksum(compressed_c_cc_real_2d_field_data)
1702 ref_chksum =
mpp_chksum(compressed_c_cc_real_2d_field_data_ref(:,:,q))
1703 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1704 write(output_unit,*)
1705 write(output_unit,*)
"My rank: ",mpp_pe()
1706 write(output_unit,*)
"Restart iteration: ",q
1707 write(output_unit,*)
"Max compressed c, cc real 2D field error: ",rmax_error
1708 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1709 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1711 "test 1: compressed c, z real 2D field data incorrect.")
1713 if (mpp_pe() .eq. mpp_root_pe())
then 1714 write(output_unit,*)
1715 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1716 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1717 write(output_unit,*)
"Compressed c, cc real 2D field data correct." 1725 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1726 compressed_h_cc_real_2d_field_name, &
1727 field_dimension_sizes, &
1728 unstructured_domain, &
1729 field_found_in_file)
1730 if (.not. field_found_in_file)
then 1732 "test 1: field "//trim(compressed_h_cc_real_2d_field_name) &
1733 //
" was not found in file " &
1734 //trim(restart_file_name))
1736 allocate(real_buffer_2d(field_dimension_sizes(1), &
1737 field_dimension_sizes(2)))
1739 compressed_h_cc_real_2d_field_name, &
1741 unstructured_domain, &
1743 if (mpp_pe() .eq. pelist(1))
then 1747 do i = 1,io_domain_npes
1748 if (mpp_pe() .eq. pelist(i))
then 1751 offset = offset + compressed_h_axis_size_per_rank(i)
1755 do j = 1,
size(compressed_h_cc_real_2d_field_data,2)
1756 do i = 1,
size(compressed_h_cc_real_2d_field_data,1)
1757 compressed_h_cc_real_2d_field_data(i,j) = real_buffer_2d(i+offset,j)
1760 deallocate(real_buffer_2d)
1761 rmax_error = maxval(abs(compressed_h_cc_real_2d_field_data - &
1762 compressed_h_cc_real_2d_field_data_ref(:,:,q)))
1763 read_in_chksum =
mpp_chksum(compressed_h_cc_real_2d_field_data)
1764 ref_chksum =
mpp_chksum(compressed_h_cc_real_2d_field_data_ref(:,:,q))
1765 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1766 write(output_unit,*)
1767 write(output_unit,*)
"My rank: ",mpp_pe()
1768 write(output_unit,*)
"Restart iteration: ",q
1769 write(output_unit,*)
"Max compressed h, cc real 2D field error: ",rmax_error
1770 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1771 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1773 "test 1: compressed h, z real 2D field data incorrect.")
1775 if (mpp_pe() .eq. mpp_root_pe())
then 1776 write(output_unit,*)
1777 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1778 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1779 write(output_unit,*)
"Compressed h, cc real 2D field data correct." 1787 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1788 compressed_c_z_cc_real_3d_field_name, &
1789 field_dimension_sizes, &
1790 unstructured_domain, &
1791 field_found_in_file)
1792 if (.not. field_found_in_file)
then 1794 "test 1: field "//trim(compressed_c_z_cc_real_3d_field_name) &
1795 //
" was not found in file " &
1796 //trim(restart_file_name))
1798 allocate(real_buffer_3d(field_dimension_sizes(1), &
1799 field_dimension_sizes(2), &
1800 field_dimension_sizes(3)))
1802 compressed_c_z_cc_real_3d_field_name, &
1804 unstructured_domain, &
1806 if (mpp_pe() .eq. pelist(1))
then 1810 do i = 1,io_domain_npes
1811 if (mpp_pe() .eq. pelist(i))
then 1814 offset = offset + compressed_c_axis_size_per_rank(i)
1818 do k = 1,
size(compressed_c_z_cc_real_3d_field_data,3)
1819 do j = 1,
size(compressed_c_z_cc_real_3d_field_data,2)
1820 do i = 1,
size(compressed_c_z_cc_real_3d_field_data,1)
1821 compressed_c_z_cc_real_3d_field_data(i,j,k) = real_buffer_3d(i+offset,j,k)
1825 deallocate(real_buffer_3d)
1826 rmax_error = maxval(abs(compressed_c_z_cc_real_3d_field_data - &
1827 compressed_c_z_cc_real_3d_field_data_ref(:,:,:,q)))
1828 read_in_chksum =
mpp_chksum(compressed_c_z_cc_real_3d_field_data)
1829 ref_chksum =
mpp_chksum(compressed_c_z_cc_real_3d_field_data_ref(:,:,:,q))
1830 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1831 write(output_unit,*)
1832 write(output_unit,*)
"My rank: ",mpp_pe()
1833 write(output_unit,*)
"Restart iteration: ",q
1834 write(output_unit,*)
"Max compressed c, z, cc real 3D field error: ",rmax_error
1835 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1836 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1838 "test 1: compressed c, z, cc real 3D field data incorrect.")
1840 if (mpp_pe() .eq. mpp_root_pe())
then 1841 write(output_unit,*)
1842 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1843 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1844 write(output_unit,*)
"Compressed c, z, cc real 3D field data correct." 1852 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1853 compressed_h_z_cc_real_3d_field_name, &
1854 field_dimension_sizes, &
1855 unstructured_domain, &
1856 field_found_in_file)
1857 if (.not. field_found_in_file)
then 1859 "test 1: field "//trim(compressed_h_z_cc_real_3d_field_name) &
1860 //
" was not found in file " &
1861 //trim(restart_file_name))
1863 allocate(real_buffer_3d(field_dimension_sizes(1), &
1864 field_dimension_sizes(2), &
1865 field_dimension_sizes(3)))
1867 compressed_h_z_cc_real_3d_field_name, &
1869 unstructured_domain, &
1871 if (mpp_pe() .eq. pelist(1))
then 1875 do i = 1,io_domain_npes
1876 if (mpp_pe() .eq. pelist(i))
then 1879 offset = offset + compressed_h_axis_size_per_rank(i)
1883 do k = 1,
size(compressed_h_z_cc_real_3d_field_data,3)
1884 do j = 1,
size(compressed_h_z_cc_real_3d_field_data,2)
1885 do i = 1,
size(compressed_h_z_cc_real_3d_field_data,1)
1886 compressed_h_z_cc_real_3d_field_data(i,j,k) = real_buffer_3d(i+offset,j,k)
1890 deallocate(real_buffer_3d)
1891 rmax_error = maxval(abs(compressed_h_z_cc_real_3d_field_data - &
1892 compressed_h_z_cc_real_3d_field_data_ref(:,:,:,q)))
1893 read_in_chksum =
mpp_chksum(compressed_h_z_cc_real_3d_field_data)
1894 ref_chksum =
mpp_chksum(compressed_h_z_cc_real_3d_field_data_ref(:,:,:,q))
1895 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1896 write(output_unit,*)
1897 write(output_unit,*)
"My rank: ",mpp_pe()
1898 write(output_unit,*)
"Restart iteration: ",q
1899 write(output_unit,*)
"Max compressed h, z, cc real 3D field error: ",rmax_error
1900 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1901 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1903 "test 1: compressed h, z, cc real 3D field data incorrect.")
1905 if (mpp_pe() .eq. mpp_root_pe())
then 1906 write(output_unit,*)
1907 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1908 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1909 write(output_unit,*)
"Compressed h, z, cc real 3D field data correct." 1917 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1918 compressed_c_cc_z_real_3d_field_name, &
1919 field_dimension_sizes, &
1920 unstructured_domain, &
1921 field_found_in_file)
1922 if (.not. field_found_in_file)
then 1924 "test 1: field "//trim(compressed_c_cc_z_real_3d_field_name) &
1925 //
" was not found in file " &
1926 //trim(restart_file_name))
1928 allocate(real_buffer_3d(field_dimension_sizes(1), &
1929 field_dimension_sizes(2), &
1930 field_dimension_sizes(3)))
1932 compressed_c_cc_z_real_3d_field_name, &
1934 unstructured_domain, &
1936 if (mpp_pe() .eq. pelist(1))
then 1940 do i = 1,io_domain_npes
1941 if (mpp_pe() .eq. pelist(i))
then 1944 offset = offset + compressed_c_axis_size_per_rank(i)
1948 do k = 1,
size(compressed_c_cc_z_real_3d_field_data,3)
1949 do j = 1,
size(compressed_c_cc_z_real_3d_field_data,2)
1950 do i = 1,
size(compressed_c_cc_z_real_3d_field_data,1)
1951 compressed_c_cc_z_real_3d_field_data(i,j,k) = real_buffer_3d(i+offset,j,k)
1955 deallocate(real_buffer_3d)
1956 rmax_error = maxval(abs(compressed_c_cc_z_real_3d_field_data - &
1957 compressed_c_cc_z_real_3d_field_data_ref(:,:,:,q)))
1958 read_in_chksum =
mpp_chksum(compressed_c_cc_z_real_3d_field_data)
1959 ref_chksum =
mpp_chksum(compressed_c_cc_z_real_3d_field_data_ref(:,:,:,q))
1960 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 1961 write(output_unit,*)
1962 write(output_unit,*)
"My rank: ",mpp_pe()
1963 write(output_unit,*)
"Restart iteration: ",q
1964 write(output_unit,*)
"Max compressed c, cc, z real 3D field error: ",rmax_error
1965 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
1966 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
1968 "test 1: compressed c, cc, z real 3D field data incorrect.")
1970 if (mpp_pe() .eq. mpp_root_pe())
then 1971 write(output_unit,*)
1972 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
1973 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
1974 write(output_unit,*)
"Compressed c, cc, z real 3D field data correct." 1982 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
1983 compressed_h_cc_z_real_3d_field_name, &
1984 field_dimension_sizes, &
1985 unstructured_domain, &
1986 field_found_in_file)
1987 if (.not. field_found_in_file)
then 1989 "test 1: field "//trim(compressed_h_cc_z_real_3d_field_name) &
1990 //
" was not found in file " &
1991 //trim(restart_file_name))
1993 allocate(real_buffer_3d(field_dimension_sizes(1), &
1994 field_dimension_sizes(2), &
1995 field_dimension_sizes(3)))
1997 compressed_h_cc_z_real_3d_field_name, &
1999 unstructured_domain, &
2001 if (mpp_pe() .eq. pelist(1))
then 2005 do i = 1,io_domain_npes
2006 if (mpp_pe() .eq. pelist(i))
then 2009 offset = offset + compressed_h_axis_size_per_rank(i)
2013 do k = 1,
size(compressed_h_cc_z_real_3d_field_data,3)
2014 do j = 1,
size(compressed_h_cc_z_real_3d_field_data,2)
2015 do i = 1,
size(compressed_h_cc_z_real_3d_field_data,1)
2016 compressed_h_cc_z_real_3d_field_data(i,j,k) = real_buffer_3d(i+offset,j,k)
2020 deallocate(real_buffer_3d)
2021 rmax_error = maxval(abs(compressed_h_cc_z_real_3d_field_data - &
2022 compressed_h_cc_z_real_3d_field_data_ref(:,:,:,q)))
2023 read_in_chksum =
mpp_chksum(compressed_h_cc_z_real_3d_field_data)
2024 ref_chksum =
mpp_chksum(compressed_h_cc_z_real_3d_field_data_ref(:,:,:,q))
2025 if (rmax_error .ne. 0.0 .or. read_in_chksum .ne. ref_chksum)
then 2026 write(output_unit,*)
2027 write(output_unit,*)
"My rank: ",mpp_pe()
2028 write(output_unit,*)
"Restart iteration: ",q
2029 write(output_unit,*)
"Max compressed h, cc, z real 3D field error: ",rmax_error
2030 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2031 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2033 "test 1: compressed h, cc, z real 3D field data incorrect.")
2035 if (mpp_pe() .eq. mpp_root_pe())
then 2036 write(output_unit,*)
2037 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2038 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2039 write(output_unit,*)
"Compressed h, cc, z real 3D field data correct." 2047 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2048 int_scalar_field_name, &
2049 field_dimension_sizes, &
2050 unstructured_domain, &
2051 field_found_in_file)
2052 if (.not. field_found_in_file)
then 2054 "test 1: field "//trim(int_scalar_field_name) &
2055 //
" was not found in file " &
2056 //trim(restart_file_name))
2058 allocate(int_buffer_1d(1))
2060 int_scalar_field_name, &
2062 unstructured_domain, &
2064 int_scalar_field_data = int_buffer_1d(1)
2065 deallocate(int_buffer_1d)
2066 imax_error = abs(int_scalar_field_data - &
2067 int_scalar_field_data_ref(q))
2068 if (imax_error .ne. 0)
then 2069 write(output_unit,*)
2070 write(output_unit,*)
"My rank: ",mpp_pe()
2071 write(output_unit,*)
"Restart iteration: ",q
2072 write(output_unit,*)
"Max integer scalar field error: ",imax_error
2074 "test 1: integer scalar field data incorrect.")
2076 if (mpp_pe() .eq. mpp_root_pe())
then 2077 write(output_unit,*)
2078 write(output_unit,*)
"Integer scalar field data correct." 2086 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2087 compressed_c_int_1d_field_name, &
2088 field_dimension_sizes, &
2089 unstructured_domain, &
2090 field_found_in_file)
2091 if (.not. field_found_in_file)
then 2093 "test 1: field "//trim(compressed_c_int_1d_field_name) &
2094 //
" was not found in file " &
2095 //trim(restart_file_name))
2097 allocate(int_buffer_1d(field_dimension_sizes(1)))
2099 compressed_c_int_1d_field_name, &
2101 unstructured_domain, &
2103 if (mpp_pe() .eq. pelist(1))
then 2107 do i = 1,io_domain_npes
2108 if (mpp_pe() .eq. pelist(i))
then 2111 offset = offset + compressed_c_axis_size_per_rank(i)
2115 do i = 1,compressed_c_axis_size
2116 compressed_c_int_1d_field_data(i) = int_buffer_1d(i+offset)
2118 deallocate(int_buffer_1d)
2119 imax_error = maxval(abs(compressed_c_int_1d_field_data - &
2120 compressed_c_int_1d_field_data_ref(:,q)))
2121 read_in_chksum =
mpp_chksum(compressed_c_int_1d_field_data)
2122 ref_chksum =
mpp_chksum(compressed_c_int_1d_field_data_ref(:,q))
2123 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2124 write(output_unit,*)
2125 write(output_unit,*)
"My rank: ",mpp_pe()
2126 write(output_unit,*)
"Restart iteration: ",q
2127 write(output_unit,*)
"Max compressed c integer 1D field error: ",imax_error
2128 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2129 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2131 "test 1: compressed c integer 1D field data incorrect.")
2133 if (mpp_pe() .eq. mpp_root_pe())
then 2134 write(output_unit,*)
2135 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2136 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2137 write(output_unit,*)
"Compressed c integer 1D field data correct." 2145 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2146 compressed_h_int_1d_field_name, &
2147 field_dimension_sizes, &
2148 unstructured_domain, &
2149 field_found_in_file)
2150 if (.not. field_found_in_file)
then 2152 "test 1: field "//trim(compressed_h_int_1d_field_name) &
2153 //
" was not found in file " &
2154 //trim(restart_file_name))
2156 allocate(int_buffer_1d(field_dimension_sizes(1)))
2158 compressed_h_int_1d_field_name, &
2160 unstructured_domain, &
2162 if (mpp_pe() .eq. pelist(1))
then 2166 do i = 1,io_domain_npes
2167 if (mpp_pe() .eq. pelist(i))
then 2170 offset = offset + compressed_h_axis_size_per_rank(i)
2174 do i = 1,compressed_h_axis_size
2175 compressed_h_int_1d_field_data(i) = int_buffer_1d(i+offset)
2177 deallocate(int_buffer_1d)
2178 imax_error = maxval(abs(compressed_h_int_1d_field_data - &
2179 compressed_h_int_1d_field_data_ref(:,q)))
2180 read_in_chksum =
mpp_chksum(compressed_h_int_1d_field_data)
2181 ref_chksum =
mpp_chksum(compressed_h_int_1d_field_data_ref(:,q))
2182 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2183 write(output_unit,*)
2184 write(output_unit,*)
"My rank: ",mpp_pe()
2185 write(output_unit,*)
"Restart iteration: ",q
2186 write(output_unit,*)
"Max compressed h integer 1D field error: ",imax_error
2187 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2188 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2190 "test 1: compressed h integer 1D field data incorrect.")
2192 if (mpp_pe() .eq. mpp_root_pe())
then 2193 write(output_unit,*)
2194 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2195 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2196 write(output_unit,*)
"Compressed h integer 1D field data correct." 2204 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2205 compressed_c_z_int_2d_field_name, &
2206 field_dimension_sizes, &
2207 unstructured_domain, &
2208 field_found_in_file)
2209 if (.not. field_found_in_file)
then 2211 "test 1: field "//trim(compressed_c_z_int_2d_field_name) &
2212 //
" was not found in file " &
2213 //trim(restart_file_name))
2215 allocate(int_buffer_2d(field_dimension_sizes(1), &
2216 field_dimension_sizes(2)))
2218 compressed_c_z_int_2d_field_name, &
2220 unstructured_domain, &
2222 if (mpp_pe() .eq. pelist(1))
then 2226 do i = 1,io_domain_npes
2227 if (mpp_pe() .eq. pelist(i))
then 2230 offset = offset + compressed_c_axis_size_per_rank(i)
2234 do j = 1,
size(compressed_c_z_int_2d_field_data,2)
2235 do i = 1,
size(compressed_c_z_int_2d_field_data,1)
2236 compressed_c_z_int_2d_field_data(i,j) = int_buffer_2d(i+offset,j)
2239 deallocate(int_buffer_2d)
2240 imax_error = maxval(abs(compressed_c_z_int_2d_field_data - &
2241 compressed_c_z_int_2d_field_data_ref(:,:,q)))
2242 read_in_chksum =
mpp_chksum(compressed_c_z_int_2d_field_data)
2243 ref_chksum =
mpp_chksum(compressed_c_z_int_2d_field_data_ref(:,:,q))
2244 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2245 write(output_unit,*)
2246 write(output_unit,*)
"My rank: ",mpp_pe()
2247 write(output_unit,*)
"Restart iteration: ",q
2248 write(output_unit,*)
"Max compressed c, z integer 2D field error: ",imax_error
2249 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2250 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2252 "test 1: compressed c, z integer 2D field data incorrect.")
2254 if (mpp_pe() .eq. mpp_root_pe())
then 2255 write(output_unit,*)
2256 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2257 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2258 write(output_unit,*)
"Compressed c, z integer 2D field data correct." 2266 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2267 compressed_h_z_int_2d_field_name, &
2268 field_dimension_sizes, &
2269 unstructured_domain, &
2270 field_found_in_file)
2271 if (.not. field_found_in_file)
then 2273 "test 1: field "//trim(compressed_h_z_int_2d_field_name) &
2274 //
" was not found in file " &
2275 //trim(restart_file_name))
2277 allocate(int_buffer_2d(field_dimension_sizes(1), &
2278 field_dimension_sizes(2)))
2280 compressed_h_z_int_2d_field_name, &
2282 unstructured_domain, &
2284 if (mpp_pe() .eq. pelist(1))
then 2288 do i = 1,io_domain_npes
2289 if (mpp_pe() .eq. pelist(i))
then 2292 offset = offset + compressed_h_axis_size_per_rank(i)
2296 do j = 1,
size(compressed_h_z_int_2d_field_data,2)
2297 do i = 1,
size(compressed_h_z_int_2d_field_data,1)
2298 compressed_h_z_int_2d_field_data(i,j) = int_buffer_2d(i+offset,j)
2301 deallocate(int_buffer_2d)
2302 imax_error = maxval(abs(compressed_h_z_int_2d_field_data - &
2303 compressed_h_z_int_2d_field_data_ref(:,:,q)))
2304 read_in_chksum =
mpp_chksum(compressed_h_z_int_2d_field_data)
2305 ref_chksum =
mpp_chksum(compressed_h_z_int_2d_field_data_ref(:,:,q))
2306 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2307 write(output_unit,*)
2308 write(output_unit,*)
"My rank: ",mpp_pe()
2309 write(output_unit,*)
"Restart iteration: ",q
2310 write(output_unit,*)
"Max compressed h, z integer 2D field error: ",imax_error
2311 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2312 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2314 "test 1: compressed h, z integer 2D field data incorrect.")
2316 if (mpp_pe() .eq. mpp_root_pe())
then 2317 write(output_unit,*)
2318 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2319 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2320 write(output_unit,*)
"Compressed h, z integer 2D field data correct." 2328 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2329 compressed_c_cc_int_2d_field_name, &
2330 field_dimension_sizes, &
2331 unstructured_domain, &
2332 field_found_in_file)
2333 if (.not. field_found_in_file)
then 2335 "test 1: field "//trim(compressed_c_cc_int_2d_field_name) &
2336 //
" was not found in file " &
2337 //trim(restart_file_name))
2339 allocate(int_buffer_2d(field_dimension_sizes(1), &
2340 field_dimension_sizes(2)))
2342 compressed_c_cc_int_2d_field_name, &
2344 unstructured_domain, &
2346 if (mpp_pe() .eq. pelist(1))
then 2350 do i = 1,io_domain_npes
2351 if (mpp_pe() .eq. pelist(i))
then 2354 offset = offset + compressed_c_axis_size_per_rank(i)
2358 do j = 1,
size(compressed_c_cc_int_2d_field_data,2)
2359 do i = 1,
size(compressed_c_cc_int_2d_field_data,1)
2360 compressed_c_cc_int_2d_field_data(i,j) = int_buffer_2d(i+offset,j)
2363 deallocate(int_buffer_2d)
2364 imax_error = maxval(abs(compressed_c_cc_int_2d_field_data - &
2365 compressed_c_cc_int_2d_field_data_ref(:,:,q)))
2366 read_in_chksum =
mpp_chksum(compressed_c_cc_int_2d_field_data)
2367 ref_chksum =
mpp_chksum(compressed_c_cc_int_2d_field_data_ref(:,:,q))
2368 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2369 write(output_unit,*)
2370 write(output_unit,*)
"My rank: ",mpp_pe()
2371 write(output_unit,*)
"Restart iteration: ",q
2372 write(output_unit,*)
"Max compressed c, cc integer 2D field error: ",imax_error
2373 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2374 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2376 "test 1: compressed c, z integer 2D field data incorrect.")
2378 if (mpp_pe() .eq. mpp_root_pe())
then 2379 write(output_unit,*)
2380 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2381 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2382 write(output_unit,*)
"Compressed c, cc integer 2D field data correct." 2390 call fms_io_unstructured_get_field_size(
"RESTART/"//trim(restart_file_name), &
2391 compressed_h_cc_int_2d_field_name, &
2392 field_dimension_sizes, &
2393 unstructured_domain, &
2394 field_found_in_file)
2395 if (.not. field_found_in_file)
then 2397 "test 1: field "//trim(compressed_h_cc_int_2d_field_name) &
2398 //
" was not found in file " &
2399 //trim(restart_file_name))
2401 allocate(int_buffer_2d(field_dimension_sizes(1), &
2402 field_dimension_sizes(2)))
2404 compressed_h_cc_int_2d_field_name, &
2406 unstructured_domain, &
2408 if (mpp_pe() .eq. pelist(1))
then 2412 do i = 1,io_domain_npes
2413 if (mpp_pe() .eq. pelist(i))
then 2416 offset = offset + compressed_h_axis_size_per_rank(i)
2420 do j = 1,
size(compressed_h_cc_int_2d_field_data,2)
2421 do i = 1,
size(compressed_h_cc_int_2d_field_data,1)
2422 compressed_h_cc_int_2d_field_data(i,j) = int_buffer_2d(i+offset,j)
2425 deallocate(int_buffer_2d)
2426 imax_error = maxval(abs(compressed_h_cc_int_2d_field_data - &
2427 compressed_h_cc_int_2d_field_data_ref(:,:,q)))
2428 read_in_chksum =
mpp_chksum(compressed_h_cc_int_2d_field_data)
2429 ref_chksum =
mpp_chksum(compressed_h_cc_int_2d_field_data_ref(:,:,q))
2430 if (imax_error .ne. 0 .or. read_in_chksum .ne. ref_chksum)
then 2431 write(output_unit,*)
2432 write(output_unit,*)
"My rank: ",mpp_pe()
2433 write(output_unit,*)
"Restart iteration: ",q
2434 write(output_unit,*)
"Max compressed h, cc integer 2D field error: ",imax_error
2435 write(output_unit,
'(a,z16)')
"Read in checksum: ",read_in_chksum
2436 write(output_unit,
'(a,z16)')
"Reference checksum: ",ref_chksum
2438 "test 1: compressed h, z integer 2D field data incorrect.")
2440 if (mpp_pe() .eq. mpp_root_pe())
then 2441 write(output_unit,*)
2442 write(output_unit,
'(a,z16)')
"Read-in data check-sum: ",read_in_chksum
2443 write(output_unit,
'(a,z16)')
"Reference data check-sum:",ref_chksum
2444 write(output_unit,*)
"Compressed h, cc integer 2D field data correct." 2451 call fms_io_unstructured_file_unit(
"RESTART/"//trim(restart_file_name), &
2453 unstructured_domain)
2454 call mpp_close(funit)
2457 if (
allocated(pelist))
then 2460 if (
allocated(compressed_c_axis_size_per_rank))
then 2461 deallocate(compressed_c_axis_size_per_rank)
2463 if (
allocated(compressed_h_axis_size_per_rank))
then 2464 deallocate(compressed_h_axis_size_per_rank)
2466 if (
allocated(x_axis_data))
then 2467 deallocate(x_axis_data)
2469 if (
allocated(y_axis_data))
then 2470 deallocate(y_axis_data)
2472 if (
allocated(z_axis_data))
then 2473 deallocate(z_axis_data)
2475 if (
allocated(cc_axis_data))
then 2476 deallocate(cc_axis_data)
2478 if (
allocated(compressed_c_axis_data))
then 2479 deallocate(compressed_c_axis_data)
2481 if (
allocated(compressed_h_axis_data))
then 2482 deallocate(compressed_h_axis_data)
2484 if (
allocated(compressed_c_real_1d_field_data))
then 2485 deallocate(compressed_c_real_1d_field_data)
2487 if (
allocated(compressed_h_real_1d_field_data))
then 2488 deallocate(compressed_h_real_1d_field_data)
2490 if (
allocated(compressed_c_z_real_2d_field_data))
then 2491 deallocate(compressed_c_z_real_2d_field_data)
2493 if (
allocated(compressed_h_z_real_2d_field_data))
then 2494 deallocate(compressed_h_z_real_2d_field_data)
2496 if (
allocated(compressed_c_cc_real_2d_field_data))
then 2497 deallocate(compressed_c_cc_real_2d_field_data)
2499 if (
allocated(compressed_h_cc_real_2d_field_data))
then 2500 deallocate(compressed_h_cc_real_2d_field_data)
2502 if (
allocated(compressed_c_z_cc_real_3d_field_data))
then 2503 deallocate(compressed_c_z_cc_real_3d_field_data)
2505 if (
allocated(compressed_h_z_cc_real_3d_field_data))
then 2506 deallocate(compressed_h_z_cc_real_3d_field_data)
2508 if (
allocated(compressed_c_cc_z_real_3d_field_data))
then 2509 deallocate(compressed_c_cc_z_real_3d_field_data)
2511 if (
allocated(compressed_h_cc_z_real_3d_field_data))
then 2512 deallocate(compressed_h_cc_z_real_3d_field_data)
2514 if (
allocated(compressed_c_int_1d_field_data))
then 2515 deallocate(compressed_c_int_1d_field_data)
2517 if (
allocated(compressed_h_int_1d_field_data))
then 2518 deallocate(compressed_h_int_1d_field_data)
2520 if (
allocated(compressed_c_z_int_2d_field_data))
then 2521 deallocate(compressed_c_z_int_2d_field_data)
2523 if (
allocated(compressed_h_z_int_2d_field_data))
then 2524 deallocate(compressed_h_z_int_2d_field_data)
2526 if (
allocated(compressed_c_cc_int_2d_field_data))
then 2527 deallocate(compressed_c_cc_int_2d_field_data)
2529 if (
allocated(compressed_h_cc_int_2d_field_data))
then 2530 deallocate(compressed_h_cc_int_2d_field_data)
2532 if (
allocated(real_scalar_field_data_ref))
then 2533 deallocate(real_scalar_field_data_ref)
2535 if (
allocated(compressed_c_real_1d_field_data_ref))
then 2536 deallocate(compressed_c_real_1d_field_data_ref)
2538 if (
allocated(compressed_h_real_1d_field_data_ref))
then 2539 deallocate(compressed_h_real_1d_field_data_ref)
2541 if (
allocated(compressed_c_z_real_2d_field_data_ref))
then 2542 deallocate(compressed_c_z_real_2d_field_data_ref)
2544 if (
allocated(compressed_h_z_real_2d_field_data_ref))
then 2545 deallocate(compressed_h_z_real_2d_field_data_ref)
2547 if (
allocated(compressed_c_cc_real_2d_field_data_ref))
then 2548 deallocate(compressed_c_cc_real_2d_field_data_ref)
2550 if (
allocated(compressed_h_cc_real_2d_field_data_ref))
then 2551 deallocate(compressed_h_cc_real_2d_field_data_ref)
2553 if (
allocated(compressed_c_z_cc_real_3d_field_data_ref))
then 2554 deallocate(compressed_c_z_cc_real_3d_field_data_ref)
2556 if (
allocated(compressed_h_z_cc_real_3d_field_data_ref))
then 2557 deallocate(compressed_h_z_cc_real_3d_field_data_ref)
2559 if (
allocated(compressed_c_cc_z_real_3d_field_data_ref))
then 2560 deallocate(compressed_c_cc_z_real_3d_field_data_ref)
2562 if (
allocated(compressed_h_cc_z_real_3d_field_data_ref))
then 2563 deallocate(compressed_h_cc_z_real_3d_field_data_ref)
2565 if (
allocated(int_scalar_field_data_ref))
then 2566 deallocate(int_scalar_field_data_ref)
2568 if (
allocated(compressed_c_int_1d_field_data_ref))
then 2569 deallocate(compressed_c_int_1d_field_data_ref)
2571 if (
allocated(compressed_h_int_1d_field_data_ref))
then 2572 deallocate(compressed_h_int_1d_field_data_ref)
2574 if (
allocated(compressed_c_z_int_2d_field_data_ref))
then 2575 deallocate(compressed_c_z_int_2d_field_data_ref)
2577 if (
allocated(compressed_h_z_int_2d_field_data_ref))
then 2578 deallocate(compressed_h_z_int_2d_field_data_ref)
2580 if (
allocated(compressed_c_cc_int_2d_field_data_ref))
then 2581 deallocate(compressed_c_cc_int_2d_field_data_ref)
2583 if (
allocated(compressed_h_cc_int_2d_field_data_ref))
then 2584 deallocate(compressed_h_cc_int_2d_field_data_ref)
2589 if (mpp_pe() .eq. mpp_root_pe())
then 2590 write(output_unit,*)
"Test 1 body complete." 2591 write(output_unit,*)
2595 end subroutine test_1
2599 end program test_unstructured_fms_io
2601
integer, parameter, public note
subroutine check(action, status)
integer, parameter, public mpp_clock_sync
integer(int_kind), parameter, public ccidx
character(len=input_str_length), dimension(:), allocatable, target, public input_nml_file
integer, parameter, public mpp_debug
subroutine, public fms_io_init()
integer(int_kind), parameter, public cidx
integer, parameter, public event_recv
subroutine, public fms_io_exit()
integer, parameter, public fatal
integer(int_kind), parameter, public hidx
integer(int_kind), parameter, public zidx
integer, parameter, public comm_tag_1