1 !***********************************************************************
2 !* GNU Lesser General Public License
4 !* This file
is part of the GFDL Flexible Modeling System (FMS).
6 !* FMS
is free software: you can redistribute it and/or modify it under
7 !* the terms of the GNU Lesser General Public License as published by
8 !* the Free Software Foundation, either
version 3 of the License, or (at
9 !* your option) any later
version.
11 !* FMS
is distributed in the hope that it
will be useful, but WITHOUT
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 !* You should have
received a copy of the GNU Lesser General Public
17 !* License along with FMS. If
not, see <http:
18 !***********************************************************************
22 !------------------------------------------------------------------------------
23 !>Add
a real scalar
field to
a restart object (restart_file_type). Return
24 !!the index of the inputted
field in the fileObj%var array.
25 function fms_io_unstructured_register_restart_field_r_0d(fileObj, &
39 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
40 character(
len=*),intent(in) :: filename !<The
name of
a file.
41 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
42 real,intent(in),target :: fdata_0d !<Some data.
43 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
44 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
45 real,intent(in),optional :: data_default !<A default value for the data.
46 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
47 character(
len=*),intent(in),optional ::
units !<Units for the
field.
48 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
49 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
53 type(domainUG),pointer :: io_domain !<Pointer to an unstructured I/O domain.
61 !Make sure that the
module has been initialized.
64 "fms_io_unstructured_register_restart_field_r_0d:" &
68 !Make sure that the value of the scalar
field is same across all ranks
71 io_domain => mpp_get_UG_io_domain(domain)
72 io_domain_npes = mpp_get_UG_domain_npes(io_domain)
73 allocate(
pelist(io_domain_npes))
74 call mpp_get_UG_domain_pelist(io_domain, &
76 allocate(fdata_per_rank(io_domain_npes))
78 call mpp_gather((/fdata_0d/), &
82 if (maxval(fdata_per_rank) .ne. fdata_0d .or. &
83 minval(fdata_per_rank) .ne. fdata_0d) then
85 "fms_io_unstructured_register_restart_field_r_0d:" &
92 deallocate(fdata_per_rank)
103 field_dimension_sizes = 1
105 !Set the ordering of the dimensions for the
field.
106 field_dimension_order(1) = TIDX
108 !Add
a field to
a restart object (restart_file_type). Get the index of the
109 !inputted
field in the fileObj%var array.
110 call fms_io_unstructured_setup_one_field(fileObj, &
113 field_dimension_order, &
114 field_dimension_sizes, &
117 mandatory=mandatory, &
118 data_default=data_default, &
121 read_only=read_only, &
122 owns_data=restart_owns_data)
124 !Point to the inputted data and return the
"index_field" for the
field.
125 fileObj%p0dr(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_0d
126 fileObj%var(index_field)%
ndim = 0
127 restart_index = index_field
130 end function fms_io_unstructured_register_restart_field_r_0d
132 !------------------------------------------------------------------------------
133 !>Add
a real 1D
field to
a restart object (restart_file_type), where the
134 !!
field is assumed to be along the unstructured axis. Return
135 !!the index of the inputted
field in the fileObj%var array.
136 function fms_io_unstructured_register_restart_field_r_1d(fileObj, &
148 result(restart_index)
151 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
152 character(
len=*),intent(in) :: filename !<The
name of
a file.
153 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
154 real,
dimension(:),intent(in),target :: fdata_1d !<Some data.
156 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
157 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
158 real,intent(in),optional :: data_default !<A default value for the data.
159 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
160 character(
len=*),intent(in),optional ::
units !<Units for the
field.
161 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
162 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
169 !Make sure that the
module has been initialized.
172 "fms_io_unstructured_register_restart_field_r_1d:" &
176 !Make sure that at least
one axis was registered to the restart object.
179 "fms_io_unstructured_register_restart_field_r_1d:" &
185 !and that it corresponds to an axis that has been registered to the
187 field_dimension_sizes = 1
188 if (fdata_1d_axes(1) .
eq. CIDX) then
189 if (.
not. allocated(fileObj%
axes(CIDX)%idx)) then
191 "fms_io_unstructured_register_restart_field_r_1d:" &
195 if (
size(fdata_1d,1) .ne. fileObj%
axes(CIDX)%nelems_for_current_rank) then
197 "fms_io_unstructured_register_restart_field_r_1d:" &
202 field_dimension_sizes(CIDX) =
size(fdata_1d,1)
203 elseif (fdata_1d_axes(1) .
eq. HIDX) then
204 if (.
not. allocated(fileObj%
axes(HIDX)%idx)) then
206 "fms_io_unstructured_register_restart_field_r_1d:" &
210 if (
size(fdata_1d,1) .ne. fileObj%
axes(HIDX)%nelems_for_current_rank) then
212 "fms_io_unstructured_register_restart_field_r_1d:" &
217 field_dimension_sizes(HIDX) =
size(fdata_1d,1)
220 "fms_io_unstructured_register_restart_field_r_1d:" &
224 !Add
a field to
a restart object (restart_file_type). Get the index of the
225 !inputted
field in the fileObj%var array.
226 call fms_io_unstructured_setup_one_field(fileObj, &
230 field_dimension_sizes, &
233 mandatory=mandatory, &
234 data_default=data_default, &
237 read_only=read_only, &
238 owns_data=restart_owns_data)
240 !Point to the inputted data and return the
"index_field" for the
field.
241 fileObj%p1dr(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_1d
242 fileObj%var(index_field)%
ndim = 1
243 restart_index = index_field
246 end function fms_io_unstructured_register_restart_field_r_1d
248 !------------------------------------------------------------------------------
249 !>Add
a real 2D
field to
a restart object (restart_file_type), where the
250 !!
field's 1st axis assumed to be along the unstructured axis and the field's
251 !!2
nd axis
is assumed to be along the z-axis. Return the index of the
252 !!inputted
field in the fileObj%var array.
253 function fms_io_unstructured_register_restart_field_r_2d(fileObj, &
265 result(restart_index)
268 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
269 character(
len=*),intent(in) :: filename !<The
name of
a file.
270 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
271 real,
dimension(:,:),intent(in),target :: fdata_2d !<Some data.
273 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
274 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
275 real,intent(in),optional :: data_default !<A default value for the data.
276 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
277 character(
len=*),intent(in),optional ::
units !<Units for the
field.
278 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
279 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
286 !Make sure that the
module has been initialized.
289 "fms_io_unstructured_register_restart_field_r_2d:" &
293 !Make sure that at least
one axis was registered to the restart object.
296 "fms_io_unstructured_register_restart_field_r_2d:" &
302 !and that it corresponds to an axis that has been registered to the
304 field_dimension_sizes = 1
305 if (fdata_2d_axes(1) .
eq. CIDX) then
306 if (.
not. allocated(fileObj%
axes(CIDX)%idx)) then
308 "fms_io_unstructured_register_restart_field_r_2d:" &
312 if (
size(fdata_2d,1) .ne. fileObj%
axes(CIDX)%nelems_for_current_rank) then
314 "fms_io_unstructured_register_restart_field_r_2d:" &
319 field_dimension_sizes(CIDX) =
size(fdata_2d,1)
320 elseif (fdata_2d_axes(1) .
eq. HIDX) then
321 if (.
not. allocated(fileObj%
axes(HIDX)%idx)) then
323 "fms_io_unstructured_register_restart_field_r_2d:" &
327 if (
size(fdata_2d,1) .ne. fileObj%
axes(HIDX)%nelems_for_current_rank) then
329 "fms_io_unstructured_register_restart_field_r_2d:" &
334 field_dimension_sizes(HIDX) =
size(fdata_2d,1)
337 "fms_io_unstructured_register_restart_field_r_2d:" &
342 !Make sure that the second
dimension of the inputted
field corresponds to
343 !either
a registered z- or
cc-axis.
344 if (fdata_2d_axes(2) .
eq. ZIDX) then
345 if (.
not. associated(fileObj%
axes(ZIDX)%data)) then
347 "fms_io_unstructured_register_restart_field_r_2d:" &
353 "fms_io_unstructured_register_restart_field_r_2d:" &
358 field_dimension_sizes(ZIDX) =
size(fdata_2d,2)
359 elseif (fdata_2d_axes(2) .
eq. CCIDX) then
360 if (.
not. associated(fileObj%
axes(CCIDX)%data)) then
362 "fms_io_unstructured_register_restart_field_r_2d:" &
368 "fms_io_unstructured_register_restart_field_r_2d:" &
373 field_dimension_sizes(CCIDX) =
size(fdata_2d,2)
376 "fms_io_unstructured_register_restart_field_r_2d:" &
381 !Add
a field to
a restart object (restart_file_type). Get the index of the
382 !inputted
field in the fileObj%var array.
383 call fms_io_unstructured_setup_one_field(fileObj, &
387 field_dimension_sizes, &
390 mandatory=mandatory, &
391 data_default=data_default, &
394 read_only=read_only, &
395 owns_data=restart_owns_data)
397 !Point to the inputted data and return the
"index_field" for the
field.
398 fileObj%p2dr(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_2d
399 fileObj%var(index_field)%
ndim = 2
400 restart_index = index_field
403 end function fms_io_unstructured_register_restart_field_r_2d
405 !------------------------------------------------------------------------------
406 !>Add
a real 3D
field to
a restart object (restart_file_type), where the
407 !!
field's 1st axis assumed to be along the unstructured axis, the fields's
408 !!second axis
is assumed to be along the z-axis, and the
field's third axis 409 !!is assumed to be along the cc-axis (???). Return the index of the 410 !!inputted field in the fileObj%var array. 411 function fms_io_unstructured_register_restart_field_r_3d(fileObj, & 423 result(restart_index) 426 type(restart_file_type),intent(inout) :: fileObj !<A restart object. 427 character(len=*),intent(in) :: filename !<The name of a file. 428 character(len=*),intent(in) :: fieldname !<The name of a field. 429 real,dimension(:,:,:),intent(in),target :: fdata_3d !<Some data. 430 integer(INT_KIND),dimension(3) :: fdata_3d_axes !<An array describing the axes for the data. 431 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain. 432 logical,intent(in),optional :: mandatory !<Flag telling if the field is mandatory for the restart. 433 real,intent(in),optional :: data_default !<A default value for the data. 434 character(len=*),intent(in),optional :: longname !<A more descriptive name of the field. 435 character(len=*),intent(in),optional :: units !<Units for the field. 436 logical(INT_KIND),intent(in),optional :: read_only !<Tells whether or not the variable will be written to the restart file. 437 logical(INT_KIND),intent(in),optional :: restart_owns_data !<Tells if the data will be deallocated when the restart object is deallocated. 438 integer(INT_KIND) :: restart_index !<Index of the inputted field in the fileObj%var array. 441 integer(INT_KIND) :: index_field !<Index of the inputted field in the fileObj%var array. 442 integer(INT_KIND),dimension(NIDX) :: field_dimension_sizes !<Array of dimension sizes for the field. 444 !Make sure that the module has been initialized. 445 if (.not. module_is_initialized) then 446 call mpp_error(FATAL, & 447 "fms_io_unstructured_register_restart_field_r_3d:" & 448 //" you must first call fms_io_init") 451 !Make sure that at least one axis was registered to the restart object. 452 if (.not. allocated(fileObj%axes)) then 453 call mpp_error(FATAL, & 454 "fms_io_unstructured_register_restart_field_r_3d:" & 455 //" no axes have been registered for the restart" & 459 !Make sure that the first dimension of the field is a "compressed" axis, 460 !and that it corresponds to an axis that has been registered to the 462 field_dimension_sizes = 1 463 if (fdata_3d_axes(1) .eq. CIDX) then 464 if (.not. allocated(fileObj%axes(CIDX)%idx)) then 465 call mpp_error(FATAL, & 466 "fms_io_unstructured_register_restart_field_r_3d:" & 467 //" a compressed c-axis was not registered" & 468 //" to the restart object.") 470 if (size(fdata_3d,1) .ne. fileObj%axes(CIDX)%nelems_for_current_rank) then 471 call mpp_error(FATAL, & 472 "fms_io_unstructured_register_restart_field_r_3d:" & 473 //" the size of the input data does not" & 474 //" match the size of the registered" & 475 //" compressed c-axis.") 477 field_dimension_sizes(CIDX) = size(fdata_3d,1) 478 elseif (fdata_3d_axes(1) .eq. HIDX) then 479 if (.not. allocated(fileObj%axes(HIDX)%idx)) then 480 call mpp_error(FATAL, & 481 "fms_io_unstructured_register_restart_field_r_3d:" & 482 //" a compressed h-axis was not registered" & 483 //" to the restart object.") 485 if (size(fdata_3d,1) .ne. fileObj%axes(HIDX)%nelems_for_current_rank) then 486 call mpp_error(FATAL, & 487 "fms_io_unstructured_register_restart_field_r_3d:" & 488 //" the size of the input data does not" & 489 //" match the size of the registered" & 490 //" compressed h-axis.") 492 field_dimension_sizes(HIDX) = size(fdata_3d,1) 494 call mpp_error(FATAL, & 495 "fms_io_unstructured_register_restart_field_r_3d:" & 496 //" The first dimension of the field must be a" & 497 //" compressed dimension.") 500 !Make sure that the second and third dimensions of the inputted field 501 !corresponds to some combination of registered z- and cc-axes. 502 if (.not. associated(fileObj%axes(ZIDX)%data)) then 503 call mpp_error(FATAL, & 504 "fms_io_unstructured_register_restart_field_r_3d:" & 505 //" a z-axis was not registered to the" & 506 //" restart object.") 508 if (.not. associated(fileObj%axes(CCIDX)%data)) then 509 call mpp_error(FATAL, & 510 "fms_io_unstructured_register_restart_field_r_3d:" & 511 //" a cc-axis was not registered to the" & 512 //" restart object.") 514 if (fdata_3d_axes(2) .eq. ZIDX) then 515 if (size(fdata_3d,2) .ne. size(fileObj%axes(ZIDX)%data)) then 516 call mpp_error(FATAL, & 517 "fms_io_unstructured_register_restart_field_r_3d:" & 518 //" the size of the input data does not" & 519 //" match the size of the registered" & 522 field_dimension_sizes(ZIDX) = size(fdata_3d,2) 523 if (fdata_3d_axes(3) .ne. CCIDX) then 524 call mpp_error(FATAL, & 525 "fms_io_unstructured_register_restart_field_r_3d:" & 526 //" unsupported axis parameter for the third" & 527 //" dimension of the field.") 528 elseif (size(fdata_3d,3) .ne. size(fileObj%axes(CCIDX)%data)) then 529 call mpp_error(FATAL, & 530 "fms_io_unstructured_register_restart_field_r_3d:" & 531 //" the size of the input data does not" & 532 //" match the size of the registered" & 536 field_dimension_sizes(CCIDX) = size(fdata_3d,3) 538 elseif (fdata_3d_axes(2) .eq. CCIDX) then 539 if (size(fdata_3d,2) .ne. size(fileObj%axes(CCIDX)%data)) then 540 call mpp_error(FATAL, & 541 "fms_io_unstructured_register_restart_field_r_3d:" & 542 //" the size of the input data does not" & 543 //" match the size of the registered" & 546 field_dimension_sizes(CCIDX) = size(fdata_3d,2) 547 if (fdata_3d_axes(3) .ne. ZIDX) then 548 call mpp_error(FATAL, & 549 "fms_io_unstructured_register_restart_field_r_3d:" & 550 //" unsupported axis parameter for the third" & 551 //" dimension of the field.") 552 elseif (size(fdata_3d,3) .ne. size(fileObj%axes(ZIDX)%data)) then 553 call mpp_error(FATAL, & 554 "fms_io_unstructured_register_restart_field_r_3d:" & 555 //" the size of the input data does not" & 556 //" match the size of the registered" & 559 field_dimension_sizes(ZIDX) = size(fdata_3d,3) 562 call mpp_error(FATAL, & 563 "fms_io_unstructured_register_restart_field_r_3d:" & 564 //" unsupported axis parameter for the second" & 565 //" dimension of the field.") 568 !Add a field to a restart object (restart_file_type). Get the index of the 569 !inputted field in the fileObj%var array. 570 call fms_io_unstructured_setup_one_field(fileObj, & 574 field_dimension_sizes, & 577 mandatory=mandatory, & 578 data_default=data_default, & 581 read_only=read_only, & 582 owns_data=restart_owns_data) 584 !Point to the inputted data and return the "index_field" for the field. 585 fileObj%p3dr(fileObj%var(index_field)%siz(4),index_field)%p => fdata_3d 586 fileObj%var(index_field)%ndim = 3 587 restart_index = index_field 590 end function fms_io_unstructured_register_restart_field_r_3d 593 !------------------------------------------------------------------------------ 594 !>Add a double_kind 2D field to a restart object (restart_file_type), where the 595 !!field's 1st axis assumed to be along the unstructured axis and the
field's 596 !!2nd axis is assumed to be along the z-axis. Return the index of the 597 !!inputted field in the fileObj%var array. 598 function fms_io_unstructured_register_restart_field_r8_2d(fileObj, & 610 result(restart_index) 613 type(restart_file_type),intent(inout) :: fileObj !<A restart object. 614 character(len=*),intent(in) :: filename !<The name of a file. 615 character(len=*),intent(in) :: fieldname !<The name of a field. 616 real(DOUBLE_KIND),dimension(:,:),intent(in),target :: fdata_2d !<Some data. 617 integer(INT_KIND),dimension(2) :: fdata_2d_axes !<An array describing the axes for the data. 618 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain. 619 logical,intent(in),optional :: mandatory !<Flag telling if the field is mandatory for the restart. 620 real(DOUBLE_KIND),intent(in),optional :: data_default !<A default value for the data. 621 character(len=*),intent(in),optional :: longname !<A more descriptive name of the field. 622 character(len=*),intent(in),optional :: units !<Units for the field. 623 logical(INT_KIND),intent(in),optional :: read_only !<Tells whether or not the variable will be written to the restart file. 624 logical(INT_KIND),intent(in),optional :: restart_owns_data !<Tells if the data will be deallocated when the restart object is deallocated. 625 integer(INT_KIND) :: restart_index !<Index of the inputted field in the fileObj%var array. 628 integer(INT_KIND) :: index_field !<Index of the inputted field in the fileObj%var array. 629 integer(INT_KIND),dimension(NIDX) :: field_dimension_sizes !<Array of dimension sizes for the field. 631 !QUICK ERROR OUT AS SUPPORT NOT YET FULLY IMPLEMENTED 632 call mpp_error(FATAL, & 633 "fms_io_unstructured_register_restart_field_r8_2d:" & 634 //" support has not yet been fully implemented") 636 !Make sure that the module has been initialized. 637 if (.not. module_is_initialized) then 638 call mpp_error(FATAL, & 639 "fms_io_unstructured_register_restart_field_r8_2d:" & 640 //" you must first call fms_io_init") 643 !Make sure that at least one axis was registered to the restart object. 644 if (.not. allocated(fileObj%axes)) then 645 call mpp_error(FATAL, & 646 "fms_io_unstructured_register_restart_field_r8_2d:" & 647 //" no axes have been registered for the restart" & 651 !Make sure that the first dimension of the field is a "compressed" axis, 652 !and that it corresponds to an axis that has been registered to the 654 field_dimension_sizes = 1 655 if (fdata_2d_axes(1) .eq. CIDX) then 656 if (.not. allocated(fileObj%axes(CIDX)%idx)) then 657 call mpp_error(FATAL, & 658 "fms_io_unstructured_register_restart_field_r8_2d:" & 659 //" a compressed c-axis was not registered" & 660 //" to the restart object.") 662 if (size(fdata_2d,1) .ne. fileObj%axes(CIDX)%nelems_for_current_rank) then 663 call mpp_error(FATAL, & 664 "fms_io_unstructured_register_restart_field_r8_2d:" & 665 //" the size of the input data does not" & 666 //" match the size of the registered" & 667 //" compressed c-axis.") 669 field_dimension_sizes(CIDX) = size(fdata_2d,1) 670 elseif (fdata_2d_axes(1) .eq. HIDX) then 671 if (.not. allocated(fileObj%axes(HIDX)%idx)) then 672 call mpp_error(FATAL, & 673 "fms_io_unstructured_register_restart_field_r8_2d:" & 674 //" a compressed h-axis was not registered" & 675 //" to the restart object.") 677 if (size(fdata_2d,1) .ne. fileObj%axes(HIDX)%nelems_for_current_rank) then 678 call mpp_error(FATAL, & 679 "fms_io_unstructured_register_restart_field_r8_2d:" & 680 //" the size of the input data does not" & 681 //" match the size of the registered" & 682 //" compressed h-axis.") 684 field_dimension_sizes(HIDX) = size(fdata_2d,1) 686 call mpp_error(FATAL, & 687 "fms_io_unstructured_register_restart_field_r8_2d:" & 688 //" The first dimension of the field must be a" & 689 //" compressed dimension.") 692 !Make sure that the second dimension of the inputted field corresponds to 693 !either a registered z- or cc-axis. 694 if (fdata_2d_axes(2) .eq. ZIDX) then 695 if (.not. associated(fileObj%axes(ZIDX)%data)) then 696 call mpp_error(FATAL, & 697 "fms_io_unstructured_register_restart_field_r8_2d:" & 698 //" a z-axis was not registered to the" & 699 //" restart object.") 701 if (size(fdata_2d,2) .ne. size(fileObj%axes(ZIDX)%data)) then 702 call mpp_error(FATAL, & 703 "fms_io_unstructured_register_restart_field_r8_2d:" & 704 //" the size of the input data does not" & 705 //" match the size of the registered" & 708 field_dimension_sizes(ZIDX) = size(fdata_2d,2) 709 elseif (fdata_2d_axes(2) .eq. CCIDX) then 710 if (.not. associated(fileObj%axes(CCIDX)%data)) then 711 call mpp_error(FATAL, & 712 "fms_io_unstructured_register_restart_field_r8_2d:" & 713 //" a cc-axis was not registered to the" & 714 //" restart object.") 716 if (size(fdata_2d,2) .ne. size(fileObj%axes(CCIDX)%data)) then 717 call mpp_error(FATAL, & 718 "fms_io_unstructured_register_restart_field_r8_2d:" & 719 //" the size of the input data does not" & 720 //" match the size of the registered" & 723 field_dimension_sizes(CCIDX) = size(fdata_2d,2) 725 call mpp_error(FATAL, & 726 "fms_io_unstructured_register_restart_field_r8_2d:" & 727 //" unsupported axis parameter for the second" & 728 //" dimension of the field.") 731 !Add a field to a restart object (restart_file_type). Get the index of the 732 !inputted field in the fileObj%var array. 733 call fms_io_unstructured_setup_one_field(fileObj, & 737 field_dimension_sizes, & 740 mandatory=mandatory, & 741 data_default=real(data_default), & 744 read_only=read_only, & 745 owns_data=restart_owns_data) 747 !Point to the inputted data and return the "index_field" for the field. 748 fileObj%p2dr8(fileObj%var(index_field)%siz(4),index_field)%p => fdata_2d 749 fileObj%var(index_field)%ndim = 2 750 restart_index = index_field 753 end function fms_io_unstructured_register_restart_field_r8_2d 755 !------------------------------------------------------------------------------ 756 !>Add a double_kind 3D field to a restart object (restart_file_type), where the 757 !!field's 1st axis assumed to be along the unstructured axis, the
fields's 758 !!second axis is assumed to be along the z-axis, and the field's third axis
759 !!
is assumed to be along the
cc-axis (???). Return the index of the
760 !!inputted
field in the fileObj%var array.
761 function fms_io_unstructured_register_restart_field_r8_3d(fileObj, &
773 result(restart_index)
776 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
777 character(
len=*),intent(in) :: filename !<The
name of
a file.
778 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
781 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
782 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
783 real(
DOUBLE_KIND),intent(in),optional :: data_default !<A default value for the data.
784 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
785 character(
len=*),intent(in),optional ::
units !<Units for the
field.
786 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
787 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
794 !QUICK ERROR OUT
AS SUPPORT NOT YET FULLY IMPLEMENTED
796 "fms_io_unstructured_register_restart_field_r8_3d:" &
799 !Make sure that the
module has been initialized.
802 "fms_io_unstructured_register_restart_field_r8_3d:" &
806 !Make sure that at least
one axis was registered to the restart object.
809 "fms_io_unstructured_register_restart_field_r8_3d:" &
815 !and that it corresponds to an axis that has been registered to the
817 field_dimension_sizes = 1
818 if (fdata_3d_axes(1) .
eq. CIDX) then
819 if (.
not. allocated(fileObj%
axes(CIDX)%idx)) then
821 "fms_io_unstructured_register_restart_field_r8_3d:" &
825 if (
size(fdata_3d,1) .ne. fileObj%
axes(CIDX)%nelems_for_current_rank) then
827 "fms_io_unstructured_register_restart_field_r8_3d:" &
832 field_dimension_sizes(CIDX) =
size(fdata_3d,1)
833 elseif (fdata_3d_axes(1) .
eq. HIDX) then
834 if (.
not. allocated(fileObj%
axes(HIDX)%idx)) then
836 "fms_io_unstructured_register_restart_field_r8_3d:" &
840 if (
size(fdata_3d,1) .ne. fileObj%
axes(HIDX)%nelems_for_current_rank) then
842 "fms_io_unstructured_register_restart_field_r8_3d:" &
847 field_dimension_sizes(HIDX) =
size(fdata_3d,1)
850 "fms_io_unstructured_register_restart_field_r8_3d:" &
855 !Make sure that the second and third dimensions of the inputted
field 856 !corresponds to
some combination of registered z- and
cc-
axes.
857 if (.
not. associated(fileObj%
axes(ZIDX)%data)) then
859 "fms_io_unstructured_register_restart_field_r8_3d:" &
863 if (.
not. associated(fileObj%
axes(CCIDX)%data)) then
865 "fms_io_unstructured_register_restart_field_r8_3d:" &
869 if (fdata_3d_axes(2) .
eq. ZIDX) then
872 "fms_io_unstructured_register_restart_field_r8_3d:" &
877 field_dimension_sizes(ZIDX) =
size(fdata_3d,2)
878 if (fdata_3d_axes(3) .ne. CCIDX) then
880 "fms_io_unstructured_register_restart_field_r8_3d:" &
883 elseif (
size(fdata_3d,3) .ne.
size(fileObj%
axes(CCIDX)%data)) then
885 "fms_io_unstructured_register_restart_field_r8_3d:" &
891 field_dimension_sizes(CCIDX) =
size(fdata_3d,3)
893 elseif (fdata_3d_axes(2) .
eq. CCIDX) then
896 "fms_io_unstructured_register_restart_field_r8_3d:" &
901 field_dimension_sizes(CCIDX) =
size(fdata_3d,2)
902 if (fdata_3d_axes(3) .ne. ZIDX) then
904 "fms_io_unstructured_register_restart_field_r8_3d:" &
907 elseif (
size(fdata_3d,3) .ne.
size(fileObj%
axes(ZIDX)%data)) then
909 "fms_io_unstructured_register_restart_field_r8_3d:" &
914 field_dimension_sizes(ZIDX) =
size(fdata_3d,3)
918 "fms_io_unstructured_register_restart_field_r8_3d:" &
923 !Add
a field to
a restart object (restart_file_type). Get the index of the
924 !inputted
field in the fileObj%var array.
925 call fms_io_unstructured_setup_one_field(fileObj, &
929 field_dimension_sizes, &
932 mandatory=mandatory, &
933 data_default=real(data_default), &
936 read_only=read_only, &
937 owns_data=restart_owns_data)
939 !Point to the inputted data and return the
"index_field" for the
field.
940 fileObj%p3dr8(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_3d
941 fileObj%var(index_field)%
ndim = 3
942 restart_index = index_field
945 end function fms_io_unstructured_register_restart_field_r8_3d
948 !------------------------------------------------------------------------------
949 !>Add an
integer scalar
field to
a restart object (restart_file_type). Return
950 !!the index of the inputted
field in the fileObj%var array.
951 function fms_io_unstructured_register_restart_field_i_0d(fileObj, &
962 result(restart_index)
965 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
966 character(
len=*),intent(in) :: filename !<The
name of
a file.
967 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
968 integer,intent(in),target :: fdata_0d !<Some data.
969 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
970 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
971 real,intent(in),optional :: data_default !<A default value for the data.
972 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
973 character(
len=*),intent(in),optional ::
units !<Units for the
field.
974 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
975 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
979 type(domainUG),pointer :: io_domain !<Pointer to an unstructured I/O domain.
987 !Make sure that the
module has been initialized.
990 "fms_io_unstructured_register_restart_field_i_0d:" &
994 !Make sure that the value of the scalar
field is same across all ranks
997 io_domain => mpp_get_UG_io_domain(domain)
998 io_domain_npes = mpp_get_UG_domain_npes(io_domain)
999 allocate(
pelist(io_domain_npes))
1000 call mpp_get_UG_domain_pelist(io_domain, &
1002 allocate(fdata_per_rank(io_domain_npes))
1003 fdata_per_rank = 0.0
1004 call mpp_gather((/fdata_0d/), &
1008 if (maxval(fdata_per_rank) .ne. fdata_0d .or. &
1009 minval(fdata_per_rank) .ne. fdata_0d) then
1011 "fms_io_unstructured_register_restart_field_i_0d:" &
1018 deallocate(fdata_per_rank)
1029 field_dimension_sizes = 1
1031 !Set the ordering of the dimensions for the
field.
1032 field_dimension_order(1) = TIDX
1034 !Add
a field to
a restart object (restart_file_type). Get the index of the
1035 !inputted
field in the fileObj%var array.
1036 call fms_io_unstructured_setup_one_field(fileObj, &
1039 field_dimension_order, &
1040 field_dimension_sizes, &
1043 mandatory=mandatory, &
1044 data_default=data_default, &
1045 longname=longname, &
1047 read_only=read_only, &
1048 owns_data=restart_owns_data)
1050 !Point to the inputted data and return the
"index_field" for the
field.
1051 fileObj%p0di(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_0d
1052 fileObj%var(index_field)%
ndim = 0
1053 restart_index = index_field
1056 end function fms_io_unstructured_register_restart_field_i_0d
1058 !------------------------------------------------------------------------------
1059 !>Add an
integer 1D
field to
a restart object (restart_file_type), where the
1060 !!
field is assumed to be along the unstructured axis. Return
1061 !!the index of the inputted
field in the fileObj%var array.
1062 function fms_io_unstructured_register_restart_field_i_1d(fileObj, &
1073 restart_owns_data) &
1074 result(restart_index)
1077 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
1078 character(
len=*),intent(in) :: filename !<The
name of
a file.
1079 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
1082 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
1083 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
1084 real,intent(in),optional :: data_default !<A default value for the data.
1085 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
1086 character(
len=*),intent(in),optional ::
units !<Units for the
field.
1087 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
1088 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
1095 !Make sure that the
module has been initialized.
1098 "fms_io_unstructured_register_restart_field_i_1d:" &
1102 !Make sure that at least
one axis was registered to the restart object.
1105 "fms_io_unstructured_register_restart_field_i_1d:" &
1111 !and that it corresponds to an axis that has been registered to the
1113 field_dimension_sizes = 1
1114 if (fdata_1d_axes(1) .
eq. CIDX) then
1115 if (.
not. allocated(fileObj%
axes(CIDX)%idx)) then
1117 "fms_io_unstructured_register_restart_field_i_1d:" &
1121 if (
size(fdata_1d,1) .ne. fileObj%
axes(CIDX)%nelems_for_current_rank) then
1123 "fms_io_unstructured_register_restart_field_i_1d:" &
1128 field_dimension_sizes(CIDX) =
size(fdata_1d,1)
1129 elseif (fdata_1d_axes(1) .
eq. HIDX) then
1130 if (.
not. allocated(fileObj%
axes(HIDX)%idx)) then
1132 "fms_io_unstructured_register_restart_field_i_1d:" &
1136 if (
size(fdata_1d,1) .ne. fileObj%
axes(HIDX)%nelems_for_current_rank) then
1138 "fms_io_unstructured_register_restart_field_i_1d:" &
1143 field_dimension_sizes(HIDX) =
size(fdata_1d,1)
1146 "fms_io_unstructured_register_restart_field_i_1d:" &
1150 !Add
a field to
a restart object (restart_file_type). Get the index of the
1151 !inputted
field in the fileObj%var array.
1152 call fms_io_unstructured_setup_one_field(fileObj, &
1156 field_dimension_sizes, &
1159 mandatory=mandatory, &
1160 data_default=data_default, &
1161 longname=longname, &
1163 read_only=read_only, &
1164 owns_data=restart_owns_data)
1166 !Point to the inputted data and return the
"index_field" for the
field.
1167 fileObj%p1di(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_1d
1168 fileObj%var(index_field)%
ndim = 1
1169 restart_index = index_field
1172 end function fms_io_unstructured_register_restart_field_i_1d
1174 !------------------------------------------------------------------------------
1175 !>Add an
integer 2D
field to
a restart object (restart_file_type), where the
1176 !!
field's 1st axis assumed to be along the unstructured axis and the field's
1177 !!2
nd axis
is assumed to be along the z-axis. Return the index of the
1178 !!inputted
field in the fileObj%var array.
1179 function fms_io_unstructured_register_restart_field_i_2d(fileObj, &
1190 restart_owns_data) &
1191 result(restart_index)
1194 type(restart_file_type),intent(inout) :: fileObj !<A restart object.
1195 character(
len=*),intent(in) :: filename !<The
name of
a file.
1196 character(
len=*),intent(in) :: fieldname !<The
name of
a field.
1199 type(domainUG),intent(in),target :: domain !<An unstructured mpp_domain.
1200 logical,intent(in),optional :: mandatory !<Flag telling
if the
field is mandatory for the restart.
1201 real,intent(in),optional :: data_default !<A default value for the data.
1202 character(
len=*),intent(in),optional :: longname !<A more descriptive
name of the
field.
1203 character(
len=*),intent(in),optional ::
units !<Units for the
field.
1204 logical(
INT_KIND),intent(in),optional :: read_only !<Tells whether or
not the variable
will be written to the restart file.
1205 logical(
INT_KIND),intent(in),optional :: restart_owns_data !<Tells
if the data
will be deallocated when the restart object
is deallocated.
1212 !Make sure that the
module has been initialized.
1215 "fms_io_unstructured_register_restart_field_i_2d:" &
1219 !Make sure that at least
one axis was registered to the restart object.
1222 "fms_io_unstructured_register_restart_field_i_2d:" &
1228 !and that it corresponds to an axis that has been registered to the
1230 field_dimension_sizes = 1
1231 if (fdata_2d_axes(1) .
eq. CIDX) then
1232 if (.
not. allocated(fileObj%
axes(CIDX)%idx)) then
1234 "fms_io_unstructured_register_restart_field_i_2d:" &
1238 if (
size(fdata_2d,1) .ne. fileObj%
axes(CIDX)%nelems_for_current_rank) then
1240 "fms_io_unstructured_register_restart_field_i_2d:" &
1245 field_dimension_sizes(CIDX) =
size(fdata_2d,1)
1246 elseif (fdata_2d_axes(1) .
eq. HIDX) then
1247 if (.
not. allocated(fileObj%
axes(HIDX)%idx)) then
1249 "fms_io_unstructured_register_restart_field_i_2d:" &
1253 if (
size(fdata_2d,1) .ne. fileObj%
axes(HIDX)%nelems_for_current_rank) then
1255 "fms_io_unstructured_register_restart_field_i_2d:" &
1260 field_dimension_sizes(HIDX) =
size(fdata_2d,1)
1263 "fms_io_unstructured_register_restart_field_i_2d:" &
1268 !Make sure that the second
dimension of the inputted
field corresponds to
1269 !either
a registered z- or
cc-axis.
1270 if (fdata_2d_axes(2) .
eq. ZIDX) then
1271 if (.
not. associated(fileObj%
axes(ZIDX)%data)) then
1273 "fms_io_unstructured_register_restart_field_i_2d:" &
1279 "fms_io_unstructured_register_restart_field_i_2d:" &
1284 field_dimension_sizes(ZIDX) =
size(fdata_2d,2)
1285 elseif (fdata_2d_axes(2) .
eq. CCIDX) then
1286 if (.
not. associated(fileObj%
axes(CCIDX)%data)) then
1288 "fms_io_unstructured_register_restart_field_i_2d:" &
1294 "fms_io_unstructured_register_restart_field_i_2d:" &
1299 field_dimension_sizes(CCIDX) =
size(fdata_2d,2)
1302 "fms_io_unstructured_register_restart_field_i_2d:" &
1307 !Add
a field to
a restart object (restart_file_type). Get the index of the
1308 !inputted
field in the fileObj%var array.
1309 call fms_io_unstructured_setup_one_field(fileObj, &
1313 field_dimension_sizes, &
1316 mandatory=mandatory, &
1317 data_default=data_default, &
1318 longname=longname, &
1320 read_only=read_only, &
1321 owns_data=restart_owns_data)
1323 !Point to the inputted data and return the
"index_field" for the
field.
1324 fileObj%p2di(fileObj%var(index_field)%siz(4),index_field)%
p => fdata_2d
1325 fileObj%var(index_field)%
ndim = 2
1326 restart_index = index_field
1329 end function fms_io_unstructured_register_restart_field_i_2d
1331 !------------------------------------------------------------------------------
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version will
type(ext_fieldtype), dimension(:), pointer, save, private field
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> set_mismatch integer ::tile update_position nbuffersz l_size integer
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_WRITE_UNLIMITED_AXIS_1D_(unit, field, domain, data, nelems_io) integer, intent(in) ::unit type(fieldtype), intent(inout) ::field type(domain2D), intent(inout) ::domain MPP_TYPE_, intent(inout) ::data(:) integer, intent(in) ::nelems_io(:) ! number of compressed elements from each ! member of the io_domain. It MUST have the ! same order as the io_domain pelist. integer, allocatable ::pelist(:) integer ::i, j, nelems, npes type(domain2d), pointer ::io_domain=> allocatable
subroutine, public copy(self, rhs)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT end
CREATE TABLE desc AS(andate YYYYMMDD, antime HHMMSS, hdr @LINK,)
type(field_mgr_type), dimension(max_fields), private fields
character(len=32) units
No description.
type(diag_axis_type), dimension(:), allocatable, save axes
real(r8), dimension(cast_m, cast_n) p
l_size ! loop over number of fields ke do je do ie to je n if(.NOT. d_comm%R_do_buf(list)) cycle from_pe
logical module_is_initialized
character(len=128) version
l_size ! loop over number of fields ke do je do ie to is
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call mpp_error(FATAL, 'MPP_TRANSMIT:you cannot transmit to ANY_PE using MPI.') else if(to_pe.NE.NULL_PE) then !no other valid cases except NULL_PE call mpp_error(FATAL
real(double), parameter one
logical function received(this, seqno)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine READ_RECORD_CORE_(unit, field, nwords, data, start, axsiz) integer, intent(in) ::unit type(fieldtype), intent(in) ::field integer, intent(in) ::nwords MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in) ::start(:), axsiz(:) integer(SHORT_KIND) ::i2vals(nwords)!rab used in conjunction with transfer intrinsic to determine size of a variable integer(KIND=1) ::one_byte(8) integer ::word_sz!#ifdef __sgi integer(INT_KIND) ::ivals(nwords) real(FLOAT_KIND) ::rvals(nwords)!#else! integer ::ivals(nwords)! real ::rvals(nwords)!#endif real(DOUBLE_KIND) ::r8vals(nwords) pointer(ptr1, i2vals) pointer(ptr2, ivals) pointer(ptr3, rvals) pointer(ptr4, r8vals) if(mpp_io_stack_size< nwords) call mpp_io_set_stack_size(nwords) call mpp_error(FATAL, 'MPP_READ currently requires use_netCDF option') end subroutine READ_RECORD_CORE_ subroutine READ_RECORD_(unit, field, nwords, data, time_level, domain, position, tile_count, start_in, axsiz_in)!routine that is finally called by all mpp_read routines to perform the read!a non-netCDF record contains:! field ID! a set of 4 coordinates(is:ie, js:je) giving the data subdomain! a timelevel and a timestamp(=NULLTIME if field is static)! 3D real data(stored as 1D)!if you are using direct access I/O, the RECL argument to OPEN must be large enough for the above!in a global direct access file, record position on PE is given by %record.!Treatment of timestamp:! We assume that static fields have been passed without a timestamp.! Here that is converted into a timestamp of NULLTIME.! For non-netCDF fields, field is treated no differently, but is written! with a timestamp of NULLTIME. There is no check in the code to prevent! the user from repeatedly writing a static field. integer, intent(in) ::unit, nwords type(fieldtype), intent(in) ::field MPP_TYPE_, intent(inout) ::data(nwords) integer, intent(in), optional ::time_level type(domain2D), intent(in), optional ::domain integer, intent(in), optional ::position, tile_count integer, intent(in), optional ::start_in(:), axsiz_in(:) integer, dimension(size(field%axes(:))) ::start, axsiz integer ::tlevel !, subdomain(4) integer ::i, error, is, ie, js, je, isg, ieg, jsg, jeg type(domain2d), pointer ::io_domain=> tlevel if(PRESENT(start_in) .AND. PRESENT(axsiz_in)) then if(size(start(! the data domain and compute domain must refer to the subdomain being passed ! In this ! since that attempts to gather all data on PE size(field%axes(:)) axsiz(i)
************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! MPP_TRANSMIT !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! subroutine MPP_TRANSMIT_(put_data, put_len, to_pe, get_data, get_len, from_pe, block, tag, recv_request, send_request)!a message-passing routine intended to be reminiscent equally of both MPI and SHMEM!put_data and get_data are contiguous MPP_TYPE_ arrays!at each call, your put_data array is put to to_pe 's get_data! your get_data array is got from from_pe 's put_data!i.e we assume that typically(e.g updating halo regions) each PE performs a put _and_ a get!special PE designations:! NULL_PE:to disable a put or a get(e.g at boundaries)! ANY_PE:if remote PE for the put or get is to be unspecific! ALL_PES:broadcast and collect operations(collect not yet implemented)!ideally we would not pass length, but this f77-style call performs better(arrays passed by address, not descriptor)!further, this permits< length > contiguous words from an array of any rank to be passed(avoiding f90 rank conformance check)!caller is responsible for completion checks(mpp_sync_self) before and after integer, intent(in) ::put_len, to_pe, get_len, from_pe MPP_TYPE_, intent(in) ::put_data(*) MPP_TYPE_, intent(out) ::get_data(*) logical, intent(in), optional ::block integer, intent(in), optional ::tag integer, intent(out), optional ::recv_request, send_request logical ::block_comm integer ::i MPP_TYPE_, allocatable, save ::local_data(:) !local copy used by non-parallel code(no SHMEM or MPI) integer ::comm_tag integer ::rsize if(.NOT.module_is_initialized) call mpp_error(FATAL, 'MPP_TRANSMIT:You must first call mpp_init.') if(to_pe.EQ.NULL_PE .AND. from_pe.EQ.NULL_PE) return block_comm=.true. if(PRESENT(block)) block_comm=block if(debug) then call SYSTEM_CLOCK(tick) write(stdout_unit,'(a, i18, a, i6, a, 2i6, 2i8)')&'T=', tick, ' PE=', pe, ' MPP_TRANSMIT begin:to_pe, from_pe, put_len, get_len=', to_pe, from_pe, put_len, get_len end if comm_tag=DEFAULT_TAG if(present(tag)) comm_tag=tag!do put first and then get if(to_pe.GE.0 .AND. to_pe.LT.npes) then!use non-blocking sends if(debug .and.(current_clock.NE.0)) call SYSTEM_CLOCK(start_tick)!z1l:truly non-blocking send.! if(request(to_pe).NE.MPI_REQUEST_NULL) then !only one message from pe-> to_pe in queue *PE waiting for to_pe ! call error else get_len so only do gets but you cannot have a pure get with MPI call a get means do a wait to ensure put on remote PE is complete error call increase mpp_nml request_multiply call MPP_TRANSMIT get_len end if return end subroutine MPP_TRANSMIT_ ! MPP_BROADCAST ! subroutine but that doesn t allow !broadcast to a subset of PEs This version and mpp_transmit will remain !backward compatible intent(inout) a
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If see< http:! ***********************************************************************subroutine MPP_UPDATE_NEST_FINE_2D_(field, nest_domain, wbuffer, ebuffer, sbuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::field3D(size(field, 1), size(field, 2), 1) MPP_TYPE_ ::wbuffer3D(size(wbuffer, 1), size(wbuffer, 2), 1) MPP_TYPE_ ::ebuffer3D(size(ebuffer, 1), size(ebuffer, 2), 1) MPP_TYPE_ ::sbuffer3D(size(sbuffer, 1), size(sbuffer, 2), 1) MPP_TYPE_ ::nbuffer3D(size(nbuffer, 1), size(nbuffer, 2), 1) pointer(ptr, field3D) pointer(ptr_w, wbuffer3D) pointer(ptr_e, ebuffer3D) pointer(ptr_s, sbuffer3D) pointer(ptr_n, nbuffer3D) ptr=LOC(field) ptr_w=LOC(wbuffer) ptr_e=LOC(ebuffer) ptr_s=LOC(sbuffer) ptr_n=LOC(nbuffer) call mpp_update_nest_fine(field3D, nest_domain, wbuffer3D, ebuffer3D, sbuffer3D, nbuffer3D, &flags, complete, position, extra_halo, name, tile_count) returnend subroutine MPP_UPDATE_NEST_FINE_2D_subroutine MPP_UPDATE_NEST_FINE_3D_(field, nest_domain, wbuffer, sbuffer, ebuffer, nbuffer, &flags, complete, position, extra_halo, name, tile_count) MPP_TYPE_, intent(in) ::field(:,:,:) type(nest_domain_type), intent(inout) ::nest_domain MPP_TYPE_, intent(inout) ::wbuffer(:,:,:) MPP_TYPE_, intent(inout) ::ebuffer(:,:,:) MPP_TYPE_, intent(inout) ::sbuffer(:,:,:) MPP_TYPE_, intent(inout) ::nbuffer(:,:,:) integer, intent(in), optional ::flags logical, intent(in), optional ::complete integer, intent(in), optional ::position integer, intent(in), optional ::extra_halo character(len= *), intent(in), optional ::name integer, intent(in), optional ::tile_count MPP_TYPE_ ::d_type type(nestSpec), pointer ::update=> dimension(MAX_DOMAIN_FIELDS)
real(r8), dimension(cast_m, cast_n) t
integer, dimension(:), allocatable pelist
*f90 *************************************************************************GNU Lesser General Public License **This file is part of the GFDL Flexible Modeling System(FMS). ! *! *FMS is free software without even the implied warranty of MERCHANTABILITY or *FITNESS FOR A PARTICULAR PURPOSE See the GNU General Public License *for more details **You should have received a copy of the GNU Lesser General Public *License along with FMS If not
subroutine, public some(xmap, some_arr, grid_id)
integer ndim
No description.