28 subroutine domain_write_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
30 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
31 character(len=*),
intent(in) :: variable_name
32 class(*),
intent(in) :: vdata
35 integer,
intent(in),
optional :: unlim_dim_level
37 integer,
intent(in),
optional :: corner
42 call compressed_write(fileobj, variable_name, vdata, &
43 unlim_dim_level=unlim_dim_level, corner=corner)
55 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
56 character(len=*),
intent(in) :: variable_name
57 class(*),
dimension(:),
intent(in) :: vdata
60 integer,
intent(in),
optional :: unlim_dim_level
62 integer,
dimension(1),
intent(in),
optional :: corner
66 integer,
dimension(1),
intent(in),
optional :: edge_lengths
71 call compressed_write(fileobj, variable_name, vdata, &
72 unlim_dim_level=unlim_dim_level, corner=corner, &
73 edge_lengths=edge_lengths)
85 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
86 character(len=*),
intent(in) :: variable_name
87 class(*),
contiguous,
dimension(:,:),
target,
intent(in) :: vdata
90 integer,
intent(in),
optional :: unlim_dim_level
92 integer,
dimension(2),
intent(in),
optional :: corner
96 integer,
dimension(2),
intent(in),
optional :: edge_lengths
101 integer(kind=i4_kind),
dimension(:,:),
allocatable :: global_buf_i4_kind
102 integer(kind=i8_kind),
dimension(:,:),
allocatable :: global_buf_i8_kind
103 real(kind=r4_kind),
dimension(:,:),
allocatable :: global_buf_r4_kind
104 real(kind=r8_kind),
dimension(:,:),
allocatable :: global_buf_r8_kind
105 logical :: buffer_includes_halos
106 type(domain2d),
pointer :: io_domain
112 integer :: xdim_index
114 integer :: ydim_index
117 integer(kind=i4_kind) :: fill_i4_kind
118 integer(kind=i8_kind) :: fill_i8_kind
119 real(kind=r4_kind) :: fill_r4_kind
120 real(kind=r8_kind) :: fill_r8_kind
121 class(*),
dimension(:,:,:,:),
pointer :: vdata_dummy
125 integer :: dim_order(2)
126 integer :: start(2), end(2)
127 integer :: ioff, joff
129 if (fileobj%use_netcdf_mpi)
then
130 call netcdf_mpi_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
135 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
136 xdim_index, ydim_index, xpos, ypos))
then
137 call compressed_write(fileobj, variable_name, vdata, &
138 unlim_dim_level=unlim_dim_level, corner=corner, &
139 edge_lengths=edge_lengths)
143 if (xdim_index .ne. 1 .or. ydim_index .ne. 2)
then
147 vdata_dummy(1:
size(vdata,1),1:
size(vdata,2), 1:1, 1:1) => vdata(:,:)
148 call domain_write_4d(fileobj, variable_name, vdata_dummy, unlim_dim_level)
156 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
157 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
158 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
161 call mpp_get_global_domain(io_domain, xbegin=xgmin, xsize=gsize(xdim_index), position=xpos)
162 call mpp_get_global_domain(io_domain, ybegin=ygmin, ysize=gsize(ydim_index), position=ypos)
165 if (fileobj%is_root)
then
172 type is (
integer(kind=i4_kind))
173 allocate(global_buf_i4_kind(gsize(1), gsize(2)))
174 global_buf_i4_kind = 0
175 if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.))
then
176 global_buf_i4_kind = fill_i4_kind
178 type is (
integer(kind=i8_kind))
179 allocate(global_buf_i8_kind(gsize(1), gsize(2)))
180 global_buf_i8_kind = 0
181 if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.))
then
182 global_buf_i8_kind = fill_i8_kind
184 type is (real(kind=r4_kind))
185 allocate(global_buf_r4_kind(gsize(1), gsize(2)))
186 global_buf_r4_kind = 0.
187 if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.))
then
188 global_buf_r4_kind = fill_r4_kind
190 type is (real(kind=r8_kind))
191 allocate(global_buf_r8_kind(gsize(1), gsize(2)))
192 global_buf_r8_kind = 0.
193 if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.))
then
194 global_buf_r8_kind = fill_r8_kind
197 call error(
"unsupported variable type: domain_write_2d_mpp_gather: file: " &
198 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
202 type is (
integer(kind=i4_kind))
203 allocate(global_buf_i4_kind(1, 1))
204 type is (
integer(kind=i8_kind))
205 allocate(global_buf_i8_kind(1, 1))
206 type is (real(kind=r4_kind))
207 allocate(global_buf_r4_kind(1, 1))
208 type is (real(kind=r8_kind))
209 allocate(global_buf_r8_kind(1, 1))
211 call error(
"unsupported variable type: domain_write_2d_mpp_gather: file: " &
212 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
220 if (buffer_includes_halos)
then
221 start(xdim_index) = isc - isd + 1
222 start(ydim_index) = jsc - jsd + 1
225 end(xdim_index) = start(xdim_index) + xc_size - 1
226 end(ydim_index) = start(ydim_index) + yc_size - 1
228 dim_order = (/xdim_index, ydim_index/)
232 type is (
integer(kind=i4_kind))
233 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, &
234 vdata(start(1):end(1), start(2):end(2)), global_buf_i4_kind, &
235 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
236 type is (
integer(kind=i8_kind))
237 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, &
238 vdata(start(1):end(1), start(2):end(2)), global_buf_i8_kind, &
239 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
240 type is (real(kind=r4_kind))
241 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, &
242 vdata(start(1):end(1), start(2):end(2)), global_buf_r4_kind, &
243 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
244 type is (real(kind=r8_kind))
245 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1, fileobj%pelist, &
246 vdata(start(1):end(1), start(2):end(2)), global_buf_r8_kind, &
247 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
249 call error(
"unsupported variable type: domain_write_2d_mpp_gather: file: " &
250 & //trim(fileobj%path)//
" variable:"// trim(variable_name))
254 if (fileobj%is_root)
then
256 type is (
integer(kind=i4_kind))
257 call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, &
258 & unlim_dim_level=unlim_dim_level)
259 type is (
integer(kind=i8_kind))
260 call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, &
261 & unlim_dim_level=unlim_dim_level)
262 type is (real(kind=r4_kind))
263 call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, &
264 & unlim_dim_level=unlim_dim_level)
265 type is (real(kind=r8_kind))
266 call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, &
267 & unlim_dim_level=unlim_dim_level)
269 call error(
"unsupported variable type: domain_write_2d_mpp_gather: file: " &
270 & //trim(fileobj%path)//
" variable:"// trim(variable_name))
282 corner, edge_lengths)
284 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
285 character(len=*),
intent(in) :: variable_name
286 class(*),
contiguous,
dimension(:,:,:),
target,
intent(in) :: vdata
289 integer,
intent(in),
optional :: unlim_dim_level
291 integer,
dimension(3),
intent(in),
optional :: corner
295 integer,
dimension(3),
intent(in),
optional :: edge_lengths
300 integer(kind=i4_kind),
dimension(:,:,:),
allocatable :: global_buf_i4_kind
301 integer(kind=i8_kind),
dimension(:,:,:),
allocatable :: global_buf_i8_kind
302 real(kind=r4_kind),
dimension(:,:,:),
allocatable :: global_buf_r4_kind
303 real(kind=r8_kind),
dimension(:,:,:),
allocatable :: global_buf_r8_kind
304 logical :: buffer_includes_halos
305 type(domain2d),
pointer :: io_domain
311 integer :: xdim_index
313 integer :: ydim_index
316 integer :: zdim_index
317 integer(kind=i4_kind) :: fill_i4_kind
318 integer(kind=i8_kind) :: fill_i8_kind
319 real(kind=r4_kind) :: fill_r4_kind
320 real(kind=r8_kind) :: fill_r8_kind
321 class(*),
dimension(:,:,:,:),
pointer :: vdata_dummy
325 integer :: dim_order(3)
326 integer :: start(3), end(3)
327 integer :: ioff, joff
329 if (fileobj%use_netcdf_mpi)
then
330 call netcdf_mpi_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
334 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
335 xdim_index, ydim_index, xpos, ypos))
then
336 call compressed_write(fileobj, variable_name, vdata, &
337 unlim_dim_level=unlim_dim_level, corner=corner, &
338 edge_lengths=edge_lengths)
346 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
347 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, buffer_includes_halos, &
348 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
351 zdim_index = 6 - xdim_index - ydim_index
354 call mpp_get_global_domain(io_domain, xbegin=xgmin, xsize=gsize(xdim_index), position=xpos)
355 call mpp_get_global_domain(io_domain, ybegin=ygmin, ysize=gsize(ydim_index), position=ypos)
356 gsize(zdim_index) =
size(vdata, zdim_index)
359 if (fileobj%is_root)
then
366 type is (
integer(kind=i4_kind))
367 allocate(global_buf_i4_kind(gsize(1), gsize(2), gsize(3)))
368 global_buf_i4_kind = 0
369 if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.))
then
370 global_buf_i4_kind = fill_i4_kind
372 type is (
integer(kind=i8_kind))
373 allocate(global_buf_i8_kind(gsize(1), gsize(2), gsize(3)))
374 global_buf_i8_kind = 0
375 if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.))
then
376 global_buf_i8_kind = fill_i8_kind
378 type is (real(kind=r4_kind))
379 allocate(global_buf_r4_kind(gsize(1), gsize(2), gsize(3)))
380 global_buf_r4_kind = 0.
381 if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.))
then
382 global_buf_r4_kind = fill_r4_kind
384 type is (real(kind=r8_kind))
385 allocate(global_buf_r8_kind(gsize(1), gsize(2), gsize(3)))
386 global_buf_r8_kind = 0.
387 if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.))
then
388 global_buf_r8_kind = fill_r8_kind
391 call error(
"unsupported variable type: domain_write_3d_mpp_gather: file: " &
392 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
396 type is (
integer(kind=i4_kind))
397 allocate(global_buf_i4_kind(1, 1, 1))
398 type is (
integer(kind=i8_kind))
399 allocate(global_buf_i8_kind(1, 1, 1))
400 type is (real(kind=r4_kind))
401 allocate(global_buf_r4_kind(1, 1, 1))
402 type is (real(kind=r8_kind))
403 allocate(global_buf_r8_kind(1, 1, 1))
405 call error(
"unsupported variable type: domain_write_3d_mpp_gather: file: " &
406 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
414 if (buffer_includes_halos)
then
415 start(xdim_index) = isc - isd + 1
416 start(ydim_index) = jsc - jsd + 1
419 end(xdim_index) = start(xdim_index) + xc_size - 1
420 end(ydim_index) = start(ydim_index) + yc_size - 1
421 end(zdim_index) =
size(vdata, zdim_index)
427 dim_order = (/xdim_index, ydim_index, zdim_index/)
431 type is (
integer(kind=i4_kind))
432 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1,
size(vdata, zdim_index), fileobj%pelist, &
433 vdata(start(1):end(1), start(2):end(2), start(3):end(3)), global_buf_i4_kind, &
434 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
435 type is (
integer(kind=i8_kind))
436 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1,
size(vdata, zdim_index), fileobj%pelist, &
437 vdata(start(1):end(1), start(2):end(2), start(3):end(3)), global_buf_i8_kind, &
438 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
439 type is (real(kind=r4_kind))
440 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1,
size(vdata, zdim_index), fileobj%pelist, &
441 vdata(start(1):end(1), start(2):end(2), start(3):end(3)), global_buf_r4_kind, &
442 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
443 type is (real(kind=r8_kind))
444 call mpp_gather(isc, isc+xc_size-1, jsc, jsc+yc_size-1,
size(vdata, zdim_index), fileobj%pelist, &
445 vdata(start(1):end(1), start(2):end(2), start(3):end(3)), global_buf_r8_kind, &
446 dim_order, fileobj%is_root, ishift=ioff, jshift=joff)
448 call error(
"unsupported variable type: domain_write_3d_mpp_gather: file: " &
449 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
453 if (fileobj%is_root)
then
455 type is (
integer(kind=i4_kind))
456 call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, &
457 unlim_dim_level=unlim_dim_level)
458 type is (
integer(kind=i8_kind))
459 call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, &
460 unlim_dim_level=unlim_dim_level)
461 type is (real(kind=r4_kind))
462 call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, &
463 unlim_dim_level=unlim_dim_level)
464 type is (real(kind=r8_kind))
465 call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, &
466 unlim_dim_level=unlim_dim_level)
468 call error(
"unsupported variable type: domain_write_3d_mpp_gather: file: " &
469 & //trim(fileobj%path)//
" variable:"//trim(variable_name))
481 corner, edge_lengths)
483 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
484 character(len=*),
intent(in) :: variable_name
485 class(*),
dimension(:,:,:,:),
intent(in) :: vdata
488 integer,
intent(in),
optional :: unlim_dim_level
490 integer,
dimension(4),
intent(in),
optional :: corner
494 integer,
dimension(4),
intent(in),
optional :: edge_lengths
499 integer(kind=i4_kind),
dimension(:,:,:,:),
allocatable :: buf_i4_kind
500 integer(kind=i8_kind),
dimension(:,:,:,:),
allocatable :: buf_i8_kind
501 real(kind=r4_kind),
dimension(:,:,:,:),
allocatable :: buf_r4_kind
502 real(kind=r8_kind),
dimension(:,:,:,:),
allocatable :: buf_r8_kind
503 logical :: buffer_includes_halos
504 integer,
dimension(4) :: c
505 integer,
dimension(4) :: e
506 integer(kind=i4_kind),
dimension(:,:,:,:),
allocatable :: global_buf_i4_kind
507 integer(kind=i8_kind),
dimension(:,:,:,:),
allocatable :: global_buf_i8_kind
508 real(kind=r4_kind),
dimension(:,:,:,:),
allocatable :: global_buf_r4_kind
509 real(kind=r8_kind),
dimension(:,:,:,:),
allocatable :: global_buf_r8_kind
511 type(domain2d),
pointer :: io_domain
516 integer,
dimension(:),
allocatable :: pe_icsize
517 integer,
dimension(:),
allocatable :: pe_iec
518 integer,
dimension(:),
allocatable :: pe_isc
519 integer,
dimension(:),
allocatable :: pe_jcsize
520 integer,
dimension(:),
allocatable :: pe_jec
521 integer,
dimension(:),
allocatable :: pe_jsc
523 integer :: xdim_index
525 integer :: ydim_index
528 integer(kind=i4_kind) :: fill_i4_kind
529 integer(kind=i8_kind) :: fill_i8_kind
530 real(kind=r4_kind) :: fill_r4_kind
531 real(kind=r8_kind) :: fill_r8_kind
537 if (fileobj%use_netcdf_mpi)
then
538 call netcdf_mpi_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
542 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
543 xdim_index, ydim_index, xpos, ypos))
then
544 call compressed_write(fileobj, variable_name, vdata, &
545 unlim_dim_level=unlim_dim_level, corner=corner, &
546 edge_lengths=edge_lengths)
550 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
551 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
552 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
557 if (fileobj%is_root)
then
558 allocate(pe_isc(
size(fileobj%pelist)))
559 allocate(pe_iec(
size(fileobj%pelist)))
560 allocate(pe_icsize(
size(fileobj%pelist)))
561 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xend=pe_iec, xsize=pe_icsize, &
563 allocate(pe_jsc(
size(fileobj%pelist)))
564 allocate(pe_jec(
size(fileobj%pelist)))
565 allocate(pe_jcsize(
size(fileobj%pelist)))
566 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, yend=pe_jec, ysize=pe_jcsize, &
570 call mpp_get_global_domain(io_domain, ybegin=ygmin, yend=ygmax, position=ypos)
571 call mpp_get_global_domain(io_domain, xbegin=xgmin, xend=xgmax, position=xpos)
575 e(xdim_index) = xgmax - xgmin + 1
576 e(ydim_index) = ygmax - ygmin + 1
581 type is (
integer(kind=i4_kind))
582 call allocate_array(global_buf_i4_kind, e)
583 global_buf_i4_kind = 0
584 if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.))
then
585 global_buf_i4_kind = fill_i4_kind
587 type is (
integer(kind=i8_kind))
588 call allocate_array(global_buf_i8_kind, e)
589 global_buf_i8_kind = 0
590 if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.))
then
591 global_buf_i8_kind = fill_i8_kind
593 type is (real(kind=r4_kind))
594 call allocate_array(global_buf_r4_kind, e)
595 global_buf_r4_kind = 0.
596 if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.))
then
597 global_buf_r4_kind = fill_r4_kind
599 type is (real(kind=r8_kind))
600 call allocate_array(global_buf_r8_kind, e)
601 global_buf_r8_kind = 0.
602 if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.))
then
603 global_buf_r8_kind = fill_r8_kind
606 call error(
"unsupported variable type: domain_write_4d: file: "//trim(fileobj%path)//
" variable:"// &
607 & trim(variable_name))
610 do i = 1,
size(fileobj%pelist)
612 c(xdim_index) = pe_isc(i) - xgmin + 1
613 c(ydim_index) = pe_jsc(i) - ygmin + 1
614 e(xdim_index) = pe_icsize(i)
615 e(ydim_index) = pe_jcsize(i)
617 type is (
integer(kind=i4_kind))
618 call allocate_array(buf_i4_kind, e)
622 if (buffer_includes_halos)
then
624 c(xdim_index) = isc - isd + 1
625 c(ydim_index) = jsc - jsd + 1
630 call get_array_section(buf_i4_kind, vdata, c, e)
631 c(xdim_index) = pe_isc(i) - xgmin + 1
632 c(ydim_index) = pe_jsc(i) - ygmin + 1
635 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i), block=.true.)
638 call put_array_section(buf_i4_kind, global_buf_i4_kind, c, e)
639 deallocate(buf_i4_kind)
640 type is (
integer(kind=i8_kind))
641 call allocate_array(buf_i8_kind, e)
645 if (buffer_includes_halos)
then
647 c(xdim_index) = isc - isd + 1
648 c(ydim_index) = jsc - jsd + 1
653 call get_array_section(buf_i8_kind, vdata, c, e)
654 c(xdim_index) = pe_isc(i) - xgmin + 1
655 c(ydim_index) = pe_jsc(i) - ygmin + 1
658 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i), block=.true.)
661 call put_array_section(buf_i8_kind, global_buf_i8_kind, c, e)
662 deallocate(buf_i8_kind)
663 type is (real(kind=r4_kind))
664 call allocate_array(buf_r4_kind, e)
668 if (buffer_includes_halos)
then
670 c(xdim_index) = isc - isd + 1
671 c(ydim_index) = jsc - jsd + 1
676 call get_array_section(buf_r4_kind, vdata, c, e)
677 c(xdim_index) = pe_isc(i) - xgmin + 1
678 c(ydim_index) = pe_jsc(i) - ygmin + 1
681 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i), block=.true.)
684 call put_array_section(buf_r4_kind, global_buf_r4_kind, c, e)
685 deallocate(buf_r4_kind)
686 type is (real(kind=r8_kind))
687 call allocate_array(buf_r8_kind, e)
691 if (buffer_includes_halos)
then
693 c(xdim_index) = isc - isd + 1
694 c(ydim_index) = jsc - jsd + 1
699 call get_array_section(buf_r8_kind, vdata, c, e)
700 c(xdim_index) = pe_isc(i) - xgmin + 1
701 c(ydim_index) = pe_jsc(i) - ygmin + 1
704 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i), block=.true.)
707 call put_array_section(buf_r8_kind, global_buf_r8_kind, c, e)
708 deallocate(buf_r8_kind)
713 deallocate(pe_icsize)
716 deallocate(pe_jcsize)
720 type is (
integer(kind=i4_kind))
721 call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, &
722 unlim_dim_level=unlim_dim_level)
723 deallocate(global_buf_i4_kind)
724 type is (
integer(kind=i8_kind))
725 call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, &
726 unlim_dim_level=unlim_dim_level)
727 deallocate(global_buf_i8_kind)
728 type is (real(kind=r4_kind))
729 call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, &
730 unlim_dim_level=unlim_dim_level)
731 deallocate(global_buf_r4_kind)
732 type is (real(kind=r8_kind))
733 call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, &
734 unlim_dim_level=unlim_dim_level)
735 deallocate(global_buf_r8_kind)
738 if (buffer_includes_halos)
then
739 c(xdim_index) = isc - isd + 1
740 c(ydim_index) = jsc - jsd + 1
742 e(xdim_index) = xc_size
743 e(ydim_index) = yc_size
745 type is (
integer(kind=i4_kind))
746 call allocate_array(buf_i4_kind, e)
747 call get_array_section(buf_i4_kind, vdata, c, e)
748 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root)
750 deallocate(buf_i4_kind)
751 type is (
integer(kind=i8_kind))
752 call allocate_array(buf_i8_kind, e)
753 call get_array_section(buf_i8_kind, vdata, c, e)
754 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root)
756 deallocate(buf_i8_kind)
757 type is (real(kind=r4_kind))
758 call allocate_array(buf_r4_kind, e)
759 call get_array_section(buf_r4_kind, vdata, c, e)
760 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root)
762 deallocate(buf_r4_kind)
763 type is (real(kind=r8_kind))
764 call allocate_array(buf_r8_kind, e)
765 call get_array_section(buf_r8_kind, vdata, c, e)
766 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root)
768 deallocate(buf_r8_kind)
770 call error(
"unsupported variable type: domain_write_4d: file: "//trim(fileobj%path)//
" variable:"// &
771 & trim(variable_name))
782 corner, edge_lengths)
784 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
785 character(len=*),
intent(in) :: variable_name
786 class(*),
dimension(:,:,:,:,:),
intent(in) :: vdata
789 integer,
intent(in),
optional :: unlim_dim_level
791 integer,
dimension(5),
intent(in),
optional :: corner
795 integer,
dimension(5),
intent(in),
optional :: edge_lengths
800 integer(kind=i4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i4_kind
801 integer(kind=i8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_i8_kind
802 real(kind=r4_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r4_kind
803 real(kind=r8_kind),
dimension(:,:,:,:,:),
allocatable :: buf_r8_kind
804 logical :: buffer_includes_halos
805 integer,
dimension(5) :: c
806 integer,
dimension(5) :: e
807 integer(kind=i4_kind),
dimension(:,:,:,:,:),
allocatable :: global_buf_i4_kind
808 integer(kind=i8_kind),
dimension(:,:,:,:,:),
allocatable :: global_buf_i8_kind
809 real(kind=r4_kind),
dimension(:,:,:,:,:),
allocatable :: global_buf_r4_kind
810 real(kind=r8_kind),
dimension(:,:,:,:,:),
allocatable :: global_buf_r8_kind
812 type(domain2d),
pointer :: io_domain
817 integer,
dimension(:),
allocatable :: pe_icsize
818 integer,
dimension(:),
allocatable :: pe_iec
819 integer,
dimension(:),
allocatable :: pe_isc
820 integer,
dimension(:),
allocatable :: pe_jcsize
821 integer,
dimension(:),
allocatable :: pe_jec
822 integer,
dimension(:),
allocatable :: pe_jsc
824 integer :: xdim_index
826 integer :: ydim_index
829 integer(kind=i4_kind) :: fill_i4_kind
830 integer(kind=i8_kind) :: fill_i8_kind
831 real(kind=r4_kind) :: fill_r4_kind
832 real(kind=r8_kind) :: fill_r8_kind
838 if (fileobj%use_netcdf_mpi)
then
839 call netcdf_mpi_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
843 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., &
844 xdim_index, ydim_index, xpos, ypos))
then
845 call compressed_write(fileobj, variable_name, vdata, &
846 unlim_dim_level=unlim_dim_level, corner=corner, &
847 edge_lengths=edge_lengths)
851 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
852 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
853 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
858 if (fileobj%is_root)
then
859 allocate(pe_isc(
size(fileobj%pelist)))
860 allocate(pe_iec(
size(fileobj%pelist)))
861 allocate(pe_icsize(
size(fileobj%pelist)))
862 call mpp_get_compute_domains(io_domain, xbegin=pe_isc, xend=pe_iec, xsize=pe_icsize, &
864 allocate(pe_jsc(
size(fileobj%pelist)))
865 allocate(pe_jec(
size(fileobj%pelist)))
866 allocate(pe_jcsize(
size(fileobj%pelist)))
867 call mpp_get_compute_domains(io_domain, ybegin=pe_jsc, yend=pe_jec, ysize=pe_jcsize, &
871 call mpp_get_global_domain(io_domain, ybegin=ygmin, yend=ygmax, position=ypos)
872 call mpp_get_global_domain(io_domain, xbegin=xgmin, xend=xgmax, position=xpos)
876 e(xdim_index) = xgmax - xgmin + 1
877 e(ydim_index) = ygmax - ygmin + 1
882 type is (
integer(kind=i4_kind))
883 call allocate_array(global_buf_i4_kind, e)
884 global_buf_i4_kind = 0
885 if (get_fill_value(fileobj, variable_name, fill_i4_kind, broadcast=.false.))
then
886 global_buf_i4_kind = fill_i4_kind
888 type is (
integer(kind=i8_kind))
889 call allocate_array(global_buf_i8_kind, e)
890 global_buf_i8_kind = 0
891 if (get_fill_value(fileobj, variable_name, fill_i8_kind, broadcast=.false.))
then
892 global_buf_i8_kind = fill_i8_kind
894 type is (real(kind=r4_kind))
895 call allocate_array(global_buf_r4_kind, e)
896 global_buf_r4_kind = 0.
897 if (get_fill_value(fileobj, variable_name, fill_r4_kind, broadcast=.false.))
then
898 global_buf_r4_kind = fill_r4_kind
900 type is (real(kind=r8_kind))
901 call allocate_array(global_buf_r8_kind, e)
902 global_buf_r8_kind = 0.
903 if (get_fill_value(fileobj, variable_name, fill_r8_kind, broadcast=.false.))
then
904 global_buf_r8_kind = fill_r8_kind
907 call error(
"unsupported variable type: domain_write_5d: file: "//trim(fileobj%path)//
" variable:"// &
908 & trim(variable_name))
911 do i = 1,
size(fileobj%pelist)
913 c(xdim_index) = pe_isc(i) - xgmin + 1
914 c(ydim_index) = pe_jsc(i) - ygmin + 1
915 e(xdim_index) = pe_icsize(i)
916 e(ydim_index) = pe_jcsize(i)
918 type is (
integer(kind=i4_kind))
919 call allocate_array(buf_i4_kind, e)
923 if (buffer_includes_halos)
then
925 c(xdim_index) = isc - isd + 1
926 c(ydim_index) = jsc - jsd + 1
931 call get_array_section(buf_i4_kind, vdata, c, e)
932 c(xdim_index) = pe_isc(i) - xgmin + 1
933 c(ydim_index) = pe_jsc(i) - ygmin + 1
936 call mpp_recv(buf_i4_kind,
size(buf_i4_kind), fileobj%pelist(i), block=.true.)
939 call put_array_section(buf_i4_kind, global_buf_i4_kind, c, e)
940 deallocate(buf_i4_kind)
941 type is (
integer(kind=i8_kind))
942 call allocate_array(buf_i8_kind, e)
946 if (buffer_includes_halos)
then
948 c(xdim_index) = isc - isd + 1
949 c(ydim_index) = jsc - jsd + 1
954 call get_array_section(buf_i8_kind, vdata, c, e)
955 c(xdim_index) = pe_isc(i) - xgmin + 1
956 c(ydim_index) = pe_jsc(i) - ygmin + 1
959 call mpp_recv(buf_i8_kind,
size(buf_i8_kind), fileobj%pelist(i), block=.true.)
962 call put_array_section(buf_i8_kind, global_buf_i8_kind, c, e)
963 deallocate(buf_i8_kind)
964 type is (real(kind=r4_kind))
965 call allocate_array(buf_r4_kind, e)
969 if (buffer_includes_halos)
then
971 c(xdim_index) = isc - isd + 1
972 c(ydim_index) = jsc - jsd + 1
977 call get_array_section(buf_r4_kind, vdata, c, e)
978 c(xdim_index) = pe_isc(i) - xgmin + 1
979 c(ydim_index) = pe_jsc(i) - ygmin + 1
982 call mpp_recv(buf_r4_kind,
size(buf_r4_kind), fileobj%pelist(i), block=.true.)
985 call put_array_section(buf_r4_kind, global_buf_r4_kind, c, e)
986 deallocate(buf_r4_kind)
987 type is (real(kind=r8_kind))
988 call allocate_array(buf_r8_kind, e)
992 if (buffer_includes_halos)
then
994 c(xdim_index) = isc - isd + 1
995 c(ydim_index) = jsc - jsd + 1
1000 call get_array_section(buf_r8_kind, vdata, c, e)
1001 c(xdim_index) = pe_isc(i) - xgmin + 1
1002 c(ydim_index) = pe_jsc(i) - ygmin + 1
1005 call mpp_recv(buf_r8_kind,
size(buf_r8_kind), fileobj%pelist(i), block=.true.)
1008 call put_array_section(buf_r8_kind, global_buf_r8_kind, c, e)
1009 deallocate(buf_r8_kind)
1014 deallocate(pe_icsize)
1017 deallocate(pe_jcsize)
1021 type is (
integer(kind=i4_kind))
1022 call netcdf_write_data(fileobj, variable_name, global_buf_i4_kind, &
1023 unlim_dim_level=unlim_dim_level)
1024 deallocate(global_buf_i4_kind)
1025 type is (
integer(kind=i8_kind))
1026 call netcdf_write_data(fileobj, variable_name, global_buf_i8_kind, &
1027 unlim_dim_level=unlim_dim_level)
1028 deallocate(global_buf_i8_kind)
1029 type is (real(kind=r4_kind))
1030 call netcdf_write_data(fileobj, variable_name, global_buf_r4_kind, &
1031 unlim_dim_level=unlim_dim_level)
1032 deallocate(global_buf_r4_kind)
1033 type is (real(kind=r8_kind))
1034 call netcdf_write_data(fileobj, variable_name, global_buf_r8_kind, &
1035 unlim_dim_level=unlim_dim_level)
1036 deallocate(global_buf_r8_kind)
1039 if (buffer_includes_halos)
then
1040 c(xdim_index) = isc - isd + 1
1041 c(ydim_index) = jsc - jsd + 1
1043 e(xdim_index) = xc_size
1044 e(ydim_index) = yc_size
1046 type is (
integer(kind=i4_kind))
1047 call allocate_array(buf_i4_kind, e)
1048 call get_array_section(buf_i4_kind, vdata, c, e)
1049 call mpp_send(buf_i4_kind,
size(buf_i4_kind), fileobj%io_root)
1051 deallocate(buf_i4_kind)
1052 type is (
integer(kind=i8_kind))
1053 call allocate_array(buf_i8_kind, e)
1054 call get_array_section(buf_i8_kind, vdata, c, e)
1055 call mpp_send(buf_i8_kind,
size(buf_i8_kind), fileobj%io_root)
1057 deallocate(buf_i8_kind)
1058 type is (real(kind=r4_kind))
1059 call allocate_array(buf_r4_kind, e)
1060 call get_array_section(buf_r4_kind, vdata, c, e)
1061 call mpp_send(buf_r4_kind,
size(buf_r4_kind), fileobj%io_root)
1063 deallocate(buf_r4_kind)
1064 type is (real(kind=r8_kind))
1065 call allocate_array(buf_r8_kind, e)
1066 call get_array_section(buf_r8_kind, vdata, c, e)
1067 call mpp_send(buf_r8_kind,
size(buf_r8_kind), fileobj%io_root)
1069 deallocate(buf_r8_kind)
1071 call error(
"unsupported variable type: domain_write_5d: file: "//trim(fileobj%path)//
" variable:"// &
1072 & trim(variable_name))
1079 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
1080 character(len=*),
intent(in) :: variable_name
1081 class(*),
dimension(:,:),
intent(in) :: vdata
1082 integer,
intent(in),
optional :: unlim_dim_level
1083 integer,
dimension(2),
intent(in),
optional :: corner
1085 integer,
dimension(2),
intent(in),
optional :: edge_lengths
1088 integer :: xdim_index
1089 integer :: ydim_index
1099 logical :: buffer_includes_halos
1102 integer,
dimension(3) :: c
1103 integer,
dimension(3) :: e
1105 integer :: unlim_dim_index
1111 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos))
then
1112 call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, &
1113 edge_lengths=edge_lengths)
1118 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
1119 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
1120 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1123 e = [shape(vdata), 1]
1127 e(xdim_index) = xc_size
1128 e(ydim_index) = yc_size
1130 if (
present(unlim_dim_level))
then
1131 unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.)
1132 if (unlim_dim_index .ne. 3)
then
1133 call error(
"unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name))
1135 c(unlim_dim_index) = unlim_dim_level
1140 select case (xdim_index)
1143 if (buffer_includes_halos)
then
1147 i1 = i0 + xc_size - 1
1148 j1 = j0 + yc_size - 1
1151 if (buffer_includes_halos)
then
1155 i1 = i0 + yc_size - 1
1156 j1 = j0 + xc_size - 1
1159 varid = get_variable_id(fileobj%ncid, trim(variable_name), &
1160 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1163 type is (
integer(kind=i4_kind))
1164 err = nf90_put_var(fileobj%ncid, varid, &
1165 vdata(i0:i1, j0:j1), &
1167 type is (
integer(kind=i8_kind))
1168 err = nf90_put_var(fileobj%ncid, varid, &
1169 vdata(i0:i1, j0:j1), &
1171 type is (real(kind=r4_kind))
1172 err = nf90_put_var(fileobj%ncid, varid, &
1173 vdata(i0:i1, j0:j1), &
1175 type is (real(kind=r8_kind))
1176 err = nf90_put_var(fileobj%ncid, varid, &
1177 vdata(i0:i1, j0:j1), &
1181 call check_netcdf_code(err,
"Failed to write variable: "//trim(variable_name))
1186 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
1187 character(len=*),
intent(in) :: variable_name
1188 class(*),
dimension(:,:,:),
intent(in) :: vdata
1189 integer,
intent(in),
optional :: unlim_dim_level
1190 integer,
dimension(3),
intent(in),
optional :: corner
1192 integer,
dimension(3),
intent(in),
optional :: edge_lengths
1195 integer :: xdim_index
1196 integer :: ydim_index
1206 logical :: buffer_includes_halos
1209 integer,
dimension(4) :: c
1210 integer,
dimension(4) :: e
1212 integer :: unlim_dim_index
1219 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos))
then
1220 call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, &
1221 edge_lengths=edge_lengths)
1226 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
1227 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
1228 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1231 e = [shape(vdata), 1]
1235 e(xdim_index) = xc_size
1236 e(ydim_index) = yc_size
1238 if (
present(unlim_dim_level))
then
1239 unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.)
1240 if (unlim_dim_index .ne. 4)
then
1241 call error(
"unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name))
1243 c(unlim_dim_index) = unlim_dim_level
1254 select case (xdim_index)
1257 if (buffer_includes_halos)
then
1260 i1 = i0 + xc_size - 1
1263 if (buffer_includes_halos)
then
1266 j1 = j0 + xc_size - 1
1269 if (buffer_includes_halos)
then
1272 k1 = k0 + xc_size - 1
1275 select case (ydim_index)
1278 if (buffer_includes_halos)
then
1281 i1 = i0 + yc_size - 1
1284 if (buffer_includes_halos)
then
1287 j1 = j0 + yc_size - 1
1290 if (buffer_includes_halos)
then
1293 k1 = k0 + yc_size - 1
1296 varid = get_variable_id(fileobj%ncid, trim(variable_name), &
1297 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1300 type is (
integer(kind=i4_kind))
1301 err = nf90_put_var(fileobj%ncid, varid, &
1302 vdata(i0:i1, j0:j1, k0:k1), &
1304 type is (
integer(kind=i8_kind))
1305 err = nf90_put_var(fileobj%ncid, varid, &
1306 vdata(i0:i1, j0:j1, k0:k1), &
1308 type is (real(kind=r4_kind))
1309 err = nf90_put_var(fileobj%ncid, varid, &
1310 vdata(i0:i1, j0:j1, k0:k1), &
1312 type is (real(kind=r8_kind))
1313 err = nf90_put_var(fileobj%ncid, varid, &
1314 vdata(i0:i1, j0:j1, k0:k1), &
1318 call check_netcdf_code(err,
"Failed to write variable: "//trim(variable_name))
1323 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
1324 character(len=*),
intent(in) :: variable_name
1325 class(*),
dimension(:,:,:,:),
intent(in) :: vdata
1326 integer,
intent(in),
optional :: unlim_dim_level
1327 integer,
dimension(4),
intent(in),
optional :: corner
1329 integer,
dimension(4),
intent(in),
optional :: edge_lengths
1332 integer :: xdim_index
1333 integer :: ydim_index
1343 logical :: buffer_includes_halos
1346 integer,
dimension(5) :: c
1347 integer,
dimension(5) :: e
1349 integer :: unlim_dim_index
1357 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos))
then
1358 call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, &
1359 edge_lengths=edge_lengths)
1364 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
1365 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
1366 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1369 e = [shape(vdata), 1]
1373 e(xdim_index) = xc_size
1374 e(ydim_index) = yc_size
1376 if (
present(unlim_dim_level))
then
1377 unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.)
1378 if (unlim_dim_index .ne. 5)
then
1379 call error(
"unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name))
1381 c(unlim_dim_index) = unlim_dim_level
1394 select case (xdim_index)
1397 if (buffer_includes_halos)
then
1400 i1 = i0 + xc_size - 1
1403 if (buffer_includes_halos)
then
1406 j1 = j0 + xc_size - 1
1409 if (buffer_includes_halos)
then
1412 k1 = k0 + xc_size - 1
1415 if (buffer_includes_halos)
then
1418 l1 = l0 + xc_size - 1
1421 select case (ydim_index)
1424 if (buffer_includes_halos)
then
1427 i1 = i0 + yc_size - 1
1430 if (buffer_includes_halos)
then
1433 j1 = j0 + yc_size - 1
1436 if (buffer_includes_halos)
then
1439 k1 = k0 + yc_size - 1
1442 if (buffer_includes_halos)
then
1445 l1 = l0 + yc_size - 1
1448 varid = get_variable_id(fileobj%ncid, trim(variable_name), &
1449 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1452 type is (
integer(kind=i4_kind))
1453 err = nf90_put_var(fileobj%ncid, varid, &
1454 vdata(i0:i1, j0:j1, k0:k1, l0:l1), &
1456 type is (
integer(kind=i8_kind))
1457 err = nf90_put_var(fileobj%ncid, varid, &
1458 vdata(i0:i1, j0:j1, k0:k1, l0:l1), &
1460 type is (real(kind=r4_kind))
1461 err = nf90_put_var(fileobj%ncid, varid, &
1462 vdata(i0:i1, j0:j1, k0:k1, l0:l1), &
1464 type is (real(kind=r8_kind))
1465 err = nf90_put_var(fileobj%ncid, varid, &
1466 vdata(i0:i1, j0:j1, k0:k1, l0:l1), &
1470 call check_netcdf_code(err,
"Failed to write variable: "//trim(variable_name))
1475 type(fmsnetcdfdomainfile_t),
intent(in) :: fileobj
1476 character(len=*),
intent(in) :: variable_name
1477 class(*),
dimension(:,:,:,:,:),
intent(in) :: vdata
1478 integer,
intent(in),
optional :: unlim_dim_level
1479 integer,
dimension(5),
intent(in),
optional :: corner
1481 integer,
dimension(5),
intent(in),
optional :: edge_lengths
1484 integer :: xdim_index
1485 integer :: ydim_index
1495 logical :: buffer_includes_halos
1498 integer,
dimension(6) :: c
1499 integer,
dimension(6) :: e
1501 integer :: unlim_dim_index
1510 if (.not. is_variable_domain_decomposed(fileobj, variable_name, .true., xdim_index, ydim_index, xpos, ypos))
then
1511 call compressed_write(fileobj, variable_name, vdata, unlim_dim_level=unlim_dim_level, corner=corner, &
1512 edge_lengths=edge_lengths)
1517 call domain_offsets(
size(vdata, xdim_index),
size(vdata, ydim_index), fileobj%domain, &
1518 xpos, ypos, isd, isc, xc_size, jsd, jsc, yc_size, &
1519 buffer_includes_halos, msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1522 e = [shape(vdata), 1]
1526 e(xdim_index) = xc_size
1527 e(ydim_index) = yc_size
1529 if (
present(unlim_dim_level))
then
1530 unlim_dim_index = get_variable_unlimited_dimension_index(fileobj, variable_name, broadcast=.false.)
1531 if (unlim_dim_index .ne. 6)
then
1532 call error(
"unlimited dimension must be the slowest varying dimension in variable: "//trim(variable_name))
1534 c(unlim_dim_index) = unlim_dim_level
1549 select case (xdim_index)
1552 if (buffer_includes_halos)
then
1555 i1 = i0 + xc_size - 1
1558 if (buffer_includes_halos)
then
1561 j1 = j0 + xc_size - 1
1564 if (buffer_includes_halos)
then
1567 k1 = k0 + xc_size - 1
1570 if (buffer_includes_halos)
then
1573 l1 = l0 + xc_size - 1
1576 if (buffer_includes_halos)
then
1579 m1 = m0 + xc_size - 1
1582 select case (ydim_index)
1585 if (buffer_includes_halos)
then
1588 i1 = i0 + yc_size - 1
1591 if (buffer_includes_halos)
then
1594 j1 = j0 + yc_size - 1
1597 if (buffer_includes_halos)
then
1600 k1 = k0 + yc_size - 1
1603 if (buffer_includes_halos)
then
1606 l1 = l0 + yc_size - 1
1609 if (buffer_includes_halos)
then
1612 m1 = m0 + yc_size - 1
1615 varid = get_variable_id(fileobj%ncid, trim(variable_name), &
1616 msg=
"file:"//trim(fileobj%path)//
" and variable:"//trim(variable_name))
1619 type is (
integer(kind=i4_kind))
1620 err = nf90_put_var(fileobj%ncid, varid, &
1621 vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), &
1623 type is (
integer(kind=i8_kind))
1624 err = nf90_put_var(fileobj%ncid, varid, &
1625 vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), &
1627 type is (real(kind=r4_kind))
1628 err = nf90_put_var(fileobj%ncid, varid, &
1629 vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), &
1631 type is (real(kind=r8_kind))
1632 err = nf90_put_var(fileobj%ncid, varid, &
1633 vdata(i0:i1, j0:j1, k0:k1, l0:l1, m0:m1), &
1637 call check_netcdf_code(err,
"Failed to write variable: "//trim(variable_name))
subroutine netcdf_mpi_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Write 5D data using NetCDF MPI.
subroutine domain_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine domain_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine domain_write_1d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine netcdf_mpi_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Write 2D data using NetCDF MPI.
subroutine domain_write_5d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine domain_write_0d(fileobj, variable_name, vdata, unlim_dim_level, corner)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine domain_write_2d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Gather "compute" domain data on the I/O root rank and then have the I/O root write out the data that ...
subroutine netcdf_mpi_write_3d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Write 3D data using NetCDF MPI.
subroutine netcdf_mpi_write_4d(fileobj, variable_name, vdata, unlim_dim_level, corner, edge_lengths)
Write 4D data using NetCDF MPI.
type(domain2d) function, pointer mpp_get_io_domain(domain)
Set user stack size.
subroutine mpp_sync_self(pelist, check, request, msg_size, msg_type)
This is to check if current PE's outstanding puts are complete but we can't use shmem_fence because w...