24 use mpi
, only : mpi_comm_world, mpi_int, mpi_byte, mpi_request_null, mpi_statuses_ignore, mpi_status_ignore, mpi_status_size
33 integer :: number_dimensions, dimensions(4)
37 character(len=STRING_LENGTH) :: name
38 integer :: field_type, data_type
39 logical ::
optional, enabled
43 character(len=STRING_LENGTH) :: name
44 logical :: send_on_terminate
45 integer :: number_of_data_fields, frequency, mpi_datatype
47 integer :: dump_requests(2)
48 character,
dimension(:),
allocatable :: send_buffer
70 type(model_state_type),
target,
intent(inout) :: current_state
72 integer :: mpi_type_data_sizing_description, mpi_type_definition_description, mpi_type_field_description, ierr
74 if (.not. options_get_logical(current_state%options_database,
"enable_io_server"))
then 76 call log_master_log(log_warn,
"Enabled IO bridge but missing IO server compilation, therefore ignoring IO bridge component")
85 mpi_type_data_sizing_description=build_mpi_type_data_sizing_description()
86 mpi_type_definition_description=build_mpi_type_definition_description()
87 mpi_type_field_description=build_mpi_type_field_description()
92 call mpi_type_free(mpi_type_data_sizing_description, ierr)
93 call mpi_type_free(mpi_type_definition_description, ierr)
94 call mpi_type_free(mpi_type_field_description, ierr)
102 type(model_state_type),
target,
intent(inout) :: current_state
121 type(model_state_type),
target,
intent(inout) :: current_state
122 integer,
intent(in) :: data_index
124 integer :: command_to_send, ierr
126 if (
data_definitions(data_index)%dump_requests(1) .ne. mpi_request_null .or. &
129 call mpi_waitall(2,
data_definitions(data_index)%dump_requests, mpi_statuses_ignore, ierr)
135 command_to_send=data_command_start+data_index
136 call mpi_issend(command_to_send, 1, mpi_int, current_state%parallel%corresponding_io_server_process, &
137 command_tag, mpi_comm_world,
data_definitions(data_index)%dump_requests(1), ierr)
139 current_state%parallel%corresponding_io_server_process, data_tag+data_index, mpi_comm_world, &
146 type(model_state_type),
target,
intent(inout) :: current_state
159 call mpi_waitall(2,
data_definitions(i)%dump_requests, mpi_statuses_ignore, ierr)
164 call mpi_send(deregister_command, 1, mpi_int, current_state%parallel%corresponding_io_server_process, &
165 command_tag, mpi_comm_world, ierr)
170 integer :: i, dump_send_buffer_size
185 integer :: type_extents(5), type_counts, i, j, tempsize, field_start, data_type, field_array_sizes, &
186 temp_size, prev_data_type, old_types(20), offsets(20), block_counts(20), ierr, field_ignores
187 logical :: field_found
190 type_extents=populate_mpi_type_extents()
197 do i=1, specific_data_definition%number_of_data_fields
198 if (data_type == 0)
then 199 prev_data_type=data_type
200 data_type=specific_data_definition%fields(i)%data_type
202 if (data_type .ne. specific_data_definition%fields(i)%data_type)
then 204 call append_mpi_datatype(field_start, i-1-field_ignores, field_array_sizes, data_type, &
205 type_extents, prev_data_type, type_counts+1, old_types, offsets, block_counts)
209 prev_data_type=data_type
210 data_type=specific_data_definition%fields(i)%data_type
211 type_counts=type_counts+1
215 if (specific_data_definition%fields(i)%field_type .eq. array_field_type .or. &
216 specific_data_definition%fields(i)%field_type .eq. map_field_type)
then 219 specific_data_definition%fields(i)%enabled=field_found
220 if (.not. field_found .or. field_size_info%number_dimensions == 0)
then 222 if (.not. specific_data_definition%fields(i)%optional)
then 223 call log_log(log_error,
"Non optional field `"//trim(specific_data_definition%fields(i)%name)//&
224 "' omitted from MONC IO server registration")
226 field_ignores=field_ignores+1
230 do j=1, field_size_info%number_dimensions
231 temp_size=temp_size*field_size_info%dimensions(j)
233 if (specific_data_definition%fields(i)%field_type .eq. map_field_type)
then 234 field_array_sizes=(field_array_sizes+temp_size*string_length*2)-1
236 field_array_sizes=(field_array_sizes+temp_size)-1
240 if (specific_data_definition%fields(i)%optional)
then 242 specific_data_definition%fields(i)%enabled=field_found
243 if (.not. field_found) field_ignores=field_ignores+1
247 if (field_start .le. i-1)
then 249 call append_mpi_datatype(field_start, i-1, field_array_sizes, data_type, &
250 type_extents, prev_data_type, type_counts+1, old_types, offsets, block_counts)
251 type_counts=type_counts+1
254 call mpi_type_struct(type_counts, block_counts, offsets, old_types, specific_data_definition%mpi_datatype, ierr)
255 call mpi_type_commit(specific_data_definition%mpi_datatype, ierr)
256 call mpi_type_size(specific_data_definition%mpi_datatype, tempsize, ierr)
263 type(model_state_type),
target,
intent(inout) :: current_state
265 type(list_type) :: published_field_descriptors
269 published_field_descriptors=get_all_component_published_fields()
270 do i=1, c_size(published_field_descriptors)
278 type(model_state_type),
target,
intent(inout) :: current_state
279 character(len=*),
intent(in) :: field_name
281 class(*),
pointer :: generic_data
283 type(component_field_information_type) :: field_information
284 type(component_field_information_type),
pointer :: field_information_info_alloc
287 field_information=get_component_field_information(current_state, field_name)
288 if (field_information%enabled)
then 289 allocate(field_information_info_alloc, source=field_information)
290 generic_data=>field_information_info_alloc
293 allocate(field_sizing)
294 field_sizing%number_dimensions=field_information%number_dimensions
295 field_sizing%dimensions=field_information%dimension_sizes
296 generic_data=>field_sizing
304 type(model_state_type),
target,
intent(inout) :: current_state
306 integer :: x_size, y_size, z_size
307 class(*),
pointer :: raw_generic
309 z_size=current_state%local_grid%size(z_index)
310 y_size=current_state%local_grid%size(y_index)
311 x_size=current_state%local_grid%size(x_index)
314 call c_put_generic(
sendable_fields,
"options_database", raw_generic, .false.)
315 if (get_number_active_q_indices() .gt. 0)
then 317 call c_put_generic(
sendable_fields,
"q_indicies", raw_generic, .false.)
320 call c_put_generic(
sendable_fields,
"local_grid_size", raw_generic, .false.)
321 call c_put_generic(
sendable_fields,
"local_grid_start", raw_generic, .false.)
326 call c_put_generic(
sendable_fields,
"x_resolution", raw_generic, .false.)
331 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then 341 call c_put_generic(
sendable_fields,
"y_resolution", raw_generic, .false.)
346 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then 363 if (current_state%number_q_fields .gt. 0)
then 367 if (
allocated(current_state%global_grid%configuration%vertical%olqbar))
then 373 if (current_state%th%active)
then 377 if (
allocated(current_state%global_grid%configuration%vertical%olthbar))
then 383 if (current_state%p%active)
then 397 integer,
intent(in),
optional :: dim1, dim2, dim3, dim4
398 class(*),
pointer :: generate_sendable_description
401 integer :: number_dimensions
406 if (
present(dim1))
then 407 field%dimensions(1)=dim1
408 number_dimensions=number_dimensions+1
410 if (
present(dim2))
then 411 field%dimensions(2)=dim2
412 number_dimensions=number_dimensions+1
414 if (
present(dim3))
then 415 field%dimensions(3)=dim3
416 number_dimensions=number_dimensions+1
418 if (
present(dim4))
then 419 field%dimensions(4)=dim4
420 number_dimensions=number_dimensions+1
422 field%number_dimensions=number_dimensions
423 generate_sendable_description=>field
431 type(model_state_type),
target,
intent(inout) :: current_state
432 integer,
intent(in) :: mpi_type_data_sizing_description
434 type(data_sizing_description_type),
dimension(:),
allocatable :: data_description
435 character,
dimension(:),
allocatable :: buffer
436 integer :: number_unique_fields, buffer_size, request_handles(2), ierr
437 real(kind=DEFAULT_PRECISION) :: dreal
440 allocate(data_description(number_unique_fields+4))
442 data_description, number_unique_fields)
443 buffer_size=(kind(dreal)*current_state%local_grid%size(z_index)) + (string_length * current_state%number_q_fields)
444 allocate(buffer(buffer_size))
446 call mpi_waitall(2, request_handles, mpi_statuses_ignore, ierr)
447 deallocate(data_description)
457 data_description, number_unique_fields)
458 type(model_state_type),
target,
intent(inout) :: current_state
459 integer,
intent(in) :: mpi_type_data_sizing_description, number_unique_fields
460 type(data_sizing_description_type),
dimension(:),
intent(inout) :: data_description
462 integer :: ierr, i, next_index, request_handle
463 character(len=STRING_LENGTH) :: field_name
467 do i=1, number_unique_fields
471 next_index=next_index+1
475 call mpi_isend(data_description, next_index-1, mpi_type_data_sizing_description, &
476 current_state%parallel%corresponding_io_server_process, data_tag, mpi_comm_world, request_handle, ierr)
485 type(model_state_type),
target,
intent(inout) :: current_state
486 character,
dimension(:),
intent(inout) :: buffer
488 character(len=STRING_LENGTH) :: q_field_name
489 type(q_metadata_type) :: q_meta_data
490 integer :: current_loc, n, ierr, request_handle
493 current_loc=pack_array_field(buffer, current_loc, real_array_1d=current_state%global_grid%configuration%vertical%zn)
494 if (current_state%number_q_fields .gt. 0)
then 495 do n=1, current_state%number_q_fields
496 q_meta_data=get_indices_descriptor(n)
497 if (q_meta_data%l_used)
then 498 q_field_name=q_meta_data%name
500 q_field_name=
"qfield_"//trim(conv_to_string(n))
502 current_loc=pack_scalar_field(buffer, current_loc, string_value=q_field_name)
505 call mpi_isend(buffer, current_loc-1, mpi_byte, current_state%parallel%corresponding_io_server_process, &
506 data_tag, mpi_comm_world, request_handle, ierr)
514 type(model_state_type),
target,
intent(inout) :: current_state
515 type(data_sizing_description_type),
dimension(:),
intent(inout) :: data_description
519 sizing_info%number_dimensions=3
520 sizing_info%dimensions(z_index)=current_state%local_grid%size(z_index)
521 sizing_info%dimensions(y_index)=current_state%local_grid%size(y_index)
522 sizing_info%dimensions(x_index)=current_state%local_grid%size(x_index)
524 sizing_info%dimensions(z_index)=current_state%local_grid%start(z_index)
525 sizing_info%dimensions(y_index)=current_state%local_grid%start(y_index)
526 sizing_info%dimensions(x_index)=current_state%local_grid%start(x_index)
528 sizing_info%dimensions(z_index)=current_state%local_grid%end(z_index)
529 sizing_info%dimensions(y_index)=current_state%local_grid%end(y_index)
530 sizing_info%dimensions(x_index)=current_state%local_grid%end(x_index)
532 sizing_info%number_dimensions=1
533 sizing_info%dimensions(1)=get_number_active_q_indices()
541 character(len=*),
intent(in) :: field_name
542 logical,
intent(out),
optional :: field_found
544 class(*),
pointer :: generic
546 if (
present(field_found)) field_found=.false.
552 if (
present(field_found)) field_found=.true.
559 type(component_field_information_type) function get_component_field_descriptor(field_name)
560 character(len=*),
intent(in) :: field_name
562 class(*),
pointer :: generic
566 type is (component_field_information_type)
582 integer,
intent(in) :: index
583 character(len=*),
intent(in) :: field_name
585 type(data_sizing_description_type),
dimension(:),
intent(inout) :: data_description
587 data_description(index)%field_name=field_name
588 data_description(index)%dimensions=field_sizing_description%number_dimensions
589 data_description(index)%dim_sizes=field_sizing_description%dimensions
599 type(model_state_type),
target,
intent(inout) :: current_state
600 integer,
intent(in) :: mpi_type_definition_description, mpi_type_field_description
602 type(definition_description_type),
dimension(:),
allocatable :: definition_descriptions
603 type(field_description_type),
dimension(:),
allocatable :: field_descriptions
604 integer :: number_defns, number_fields, status(mpi_status_size), ierr
606 call mpi_send(register_command, 1, mpi_int, current_state%parallel%corresponding_io_server_process, &
607 command_tag, mpi_comm_world, ierr)
609 call mpi_probe(current_state%parallel%corresponding_io_server_process, data_tag, mpi_comm_world, status, ierr)
610 call mpi_get_count(status, mpi_type_definition_description, number_defns, ierr)
611 allocate(definition_descriptions(number_defns))
613 call mpi_recv(definition_descriptions, number_defns, mpi_type_definition_description, &
614 current_state%parallel%corresponding_io_server_process, data_tag, mpi_comm_world, mpi_status_ignore, ierr)
617 allocate(field_descriptions(number_fields))
618 call mpi_recv(field_descriptions, number_fields, mpi_type_field_description, &
619 current_state%parallel%corresponding_io_server_process, data_tag, mpi_comm_world, mpi_status_ignore, ierr)
621 deallocate(definition_descriptions)
629 type(definition_description_type),
dimension(:),
intent(inout) :: definition_descriptions
630 integer,
intent(in) :: number_defns
648 type(definition_description_type),
dimension(:),
intent(inout) :: definition_descriptions
649 type(field_description_type),
dimension(:),
intent(inout) :: field_descriptions
650 integer,
intent(in) :: number_defns, number_fields
652 integer :: i, definition_index, field_index
657 data_definitions(i)%send_on_terminate=definition_descriptions(i)%send_on_terminate
660 allocate(
data_definitions(i)%fields(definition_descriptions(i)%number_fields))
662 do i=1, number_fields
666 data_definitions(definition_index)%fields(field_index)%name=field_descriptions(i)%field_name
667 data_definitions(definition_index)%fields(field_index)%field_type=field_descriptions(i)%field_type
668 data_definitions(definition_index)%fields(field_index)%data_type=field_descriptions(i)%data_type
669 data_definitions(definition_index)%fields(field_index)%optional=field_descriptions(i)%optional
670 if (field_descriptions(i)%optional .or. field_descriptions(i)%field_type == array_field_type .or. &
671 field_descriptions(i)%field_type == map_field_type)
then 674 if (.not. field_descriptions(i)%optional)
data_definitions(definition_index)%fields(field_index)%enabled=.true.
682 character(len=*),
intent(in) :: name
699 type(model_state_type),
target,
intent(inout) :: current_state
702 integer :: current_buffer_point, i
704 current_buffer_point=1
705 do i=1, data_definition%number_of_data_fields
706 if (data_definition%fields(i)%enabled)
then 707 if (data_definition%fields(i)%field_type == array_field_type)
then 709 current_buffer_point)
710 else if (data_definition%fields(i)%field_type == map_field_type)
then 712 current_buffer_point)
713 else if (data_definition%fields(i)%field_type == scalar_field_type)
then 715 current_buffer_point)
728 type(model_state_type),
target,
intent(inout) :: current_state
731 integer,
intent(in) :: current_buffer_point
733 if (field%name .eq.
"timestep")
then 735 int_value=current_state%timestep)
736 else if (field%name .eq.
"terminated")
then 739 else if (field%name .eq.
"z_size")
then 741 int_value=current_state%global_grid%size(z_index))
742 else if (field%name .eq.
"y_size")
then 744 int_value=current_state%global_grid%size(y_index))
745 else if (field%name .eq.
"y_bottom")
then 747 real_value=current_state%global_grid%bottom(y_index))
748 else if (field%name .eq.
"y_top")
then 750 real_value=current_state%global_grid%top(y_index))
751 else if (field%name .eq.
"y_resolution")
then 753 real_value=current_state%global_grid%resolution(y_index))
754 else if (field%name .eq.
"x_size")
then 756 int_value=current_state%global_grid%size(x_index))
757 else if (field%name .eq.
"x_bottom")
then 759 real_value=current_state%global_grid%bottom(x_index))
760 else if (field%name .eq.
"x_top")
then 762 real_value=current_state%global_grid%top(x_index))
763 else if (field%name .eq.
"x_resolution")
then 765 real_value=current_state%global_grid%resolution(x_index))
766 else if (field%name .eq.
"time")
then 769 real_value=current_state%time+current_state%dtm)
770 else if (field%name .eq.
"ugal")
then 772 real_value=current_state%ugal)
773 else if (field%name .eq.
"vgal")
then 775 real_value=current_state%vgal)
776 else if (field%name .eq.
"nqfields")
then 778 int_value=current_state%number_q_fields)
779 else if (field%name .eq.
"dtm")
then 781 real_value=current_state%dtm)
782 else if (field%name .eq.
"dtm_new")
then 784 real_value=current_state%dtm_new)
785 else if (field%name .eq.
"absolute_new_dtm")
then 787 real_value=current_state%absolute_new_dtm)
791 data_definition, field, current_buffer_point)
803 field, current_buffer_point)
804 type(model_state_type),
target,
intent(inout) :: current_state
807 integer,
intent(in) :: current_buffer_point
809 type(component_field_information_type) :: field_descriptor
810 type(component_field_value_type) :: published_value
813 published_value=get_component_field_value(current_state, field%name)
814 if (field_descriptor%data_type == component_double_data_type)
then 816 current_buffer_point, real_value=published_value%scalar_real)
817 else if (field_descriptor%data_type == component_integer_data_type)
then 819 current_buffer_point, int_value=published_value%scalar_int)
830 type(model_state_type),
target,
intent(inout) :: current_state
833 integer,
intent(in) :: current_buffer_point
836 type(q_metadata_type) :: specific_q_data
837 type(hashmap_type) :: q_indicies_map
839 if (field%name .eq.
"options_database")
then 840 pack_map_into_send_buffer=pack_map_field(data_definition%send_buffer, current_buffer_point, current_state%options_database)
841 else if (field%name .eq.
"q_indicies")
then 842 do i=1, get_max_number_q_indices()
843 specific_q_data=get_indices_descriptor(i)
844 if (specific_q_data%l_used)
then 845 call c_put_integer(q_indicies_map, specific_q_data%name, i)
849 call c_free(q_indicies_map)
860 type(model_state_type),
target,
intent(inout) :: current_state
863 integer,
intent(in) :: current_buffer_point
865 if (field%name .eq.
"local_grid_size")
then 867 int_array=current_state%local_grid%size)
868 else if (field%name .eq.
"local_grid_start")
then 870 int_array=current_state%local_grid%start)
871 else if (field%name .eq.
"z")
then 873 real_array_1d=current_state%global_grid%configuration%vertical%z)
874 else if (field%name .eq.
"olubar")
then 876 real_array_1d=current_state%global_grid%configuration%vertical%olubar)
877 else if (field%name .eq.
"olzubar")
then 879 real_array_1d=current_state%global_grid%configuration%vertical%olzubar)
880 else if (field%name .eq.
"olvbar")
then 882 real_array_1d=current_state%global_grid%configuration%vertical%olvbar)
883 else if (field%name .eq.
"olzvbar")
then 885 real_array_1d=current_state%global_grid%configuration%vertical%olzvbar)
886 else if (field%name .eq.
"olthbar")
then 888 real_array_1d=current_state%global_grid%configuration%vertical%olthbar)
889 else if (field%name .eq.
"olzthbar")
then 891 real_array_1d=current_state%global_grid%configuration%vertical%olzthbar)
892 else if (field%name .eq.
"olqbar")
then 894 real_array_2d=current_state%global_grid%configuration%vertical%olqbar)
895 else if (field%name .eq.
"olzqbar")
then 897 real_array_2d=current_state%global_grid%configuration%vertical%olzqbar)
898 else if (field%name .eq.
"thref")
then 900 real_array_1d=current_state%global_grid%configuration%vertical%thref)
901 else if (field%name .eq.
"prefn")
then 903 real_array_1d=current_state%global_grid%configuration%vertical%prefn)
904 else if (field%name .eq.
"rhon")
then 906 real_array_1d=current_state%global_grid%configuration%vertical%rhon)
907 else if (field%name .eq.
"rho")
then 909 real_array_1d=current_state%global_grid%configuration%vertical%rho)
910 else if (field%name .eq.
"u")
then 911 current_state%u%data=current_state%u%data+current_state%ugal
913 current_buffer_point, current_state%local_grid)
914 current_state%u%data=current_state%u%data-current_state%ugal
915 else if (field%name .eq.
"u_nogal")
then 917 current_state%local_grid)
918 else if (field%name .eq.
"zu")
then 920 current_state%local_grid)
921 else if (field%name .eq.
"v")
then 922 current_state%v%data=current_state%v%data+current_state%vgal
924 current_state%local_grid)
925 current_state%v%data=current_state%v%data-current_state%vgal
926 else if (field%name .eq.
"v_nogal")
then 928 current_state%local_grid)
929 else if (field%name .eq.
"zv")
then 931 current_state%local_grid)
932 else if (field%name .eq.
"w")
then 934 current_state%local_grid)
935 else if (field%name .eq.
"zw")
then 937 current_state%local_grid)
938 else if (field%name .eq.
"q")
then 940 current_buffer_point, current_state%local_grid)
941 else if (field%name .eq.
"zq")
then 943 current_buffer_point, current_state%local_grid)
944 else if (field%name .eq.
"th")
then 946 current_state%local_grid)
947 else if (field%name .eq.
"zth")
then 949 current_state%local_grid)
950 else if (field%name .eq.
"p")
then 952 current_state%local_grid)
956 data_definition, field, current_buffer_point)
968 field, current_buffer_point)
969 type(model_state_type),
target,
intent(inout) :: current_state
972 integer,
intent(in) :: current_buffer_point
974 type(component_field_information_type) :: field_descriptor
975 type(component_field_value_type) :: published_value
978 published_value=get_component_field_value(current_state, field%name)
979 if (field_descriptor%data_type == component_double_data_type)
then 980 if (field_descriptor%number_dimensions == 1)
then 982 current_buffer_point, real_array_1d=published_value%real_1d_array)
983 deallocate(published_value%real_1d_array)
984 else if (field_descriptor%number_dimensions == 2)
then 986 current_buffer_point, real_array_2d=published_value%real_2d_array)
987 deallocate(published_value%real_2d_array)
988 else if (field_descriptor%number_dimensions == 3)
then 990 current_buffer_point, real_array_3d=published_value%real_3d_array)
991 deallocate(published_value%real_3d_array)
992 else if (field_descriptor%number_dimensions == 4)
then 994 current_buffer_point, real_array_4d=published_value%real_4d_array)
995 deallocate(published_value%real_4d_array)
1007 character,
dimension(:),
allocatable,
intent(inout) :: buffer
1008 type(prognostic_field_type),
intent(inout) :: prognostic
1009 integer,
intent(in) :: start_offset
1010 type(local_grid_type),
intent(inout) :: local_grid
1012 integer :: target_end
1014 target_end=start_offset + (local_grid%size(z_index)*local_grid%size(y_index)*local_grid%size(x_index)*kind(prognostic%data)-1)
1016 buffer(start_offset : target_end) = transfer(prognostic%data(&
1017 local_grid%local_domain_start_index(z_index): local_grid%local_domain_end_index(z_index),&
1018 local_grid%local_domain_start_index(y_index): local_grid%local_domain_end_index(y_index), &
1019 local_grid%local_domain_start_index(x_index): local_grid%local_domain_end_index(x_index)), &
1020 buffer(start_offset : target_end))
1031 integer function pack_q_fields(buffer, q_fields, number_q_fields, start_offset, local_grid)
1032 character,
dimension(:),
allocatable,
intent(inout) :: buffer
1033 type(prognostic_field_type),
dimension(:),
intent(inout) :: q_fields
1034 integer,
intent(in) :: start_offset, number_q_fields
1035 type(local_grid_type),
intent(inout) :: local_grid
1037 integer :: target_end, i, current_starting_index
1039 current_starting_index=start_offset
1041 do i=1,number_q_fields
1042 target_end=current_starting_index + (local_grid%size(z_index)*local_grid%size(y_index)*&
1043 local_grid%size(x_index)*kind(q_fields(i)%data)-1)
1044 buffer(current_starting_index : target_end) = transfer(q_fields(i)%data(&
1045 local_grid%local_domain_start_index(z_index): local_grid%local_domain_end_index(z_index),&
1046 local_grid%local_domain_start_index(y_index): local_grid%local_domain_end_index(y_index), &
1047 local_grid%local_domain_start_index(x_index): local_grid%local_domain_end_index(x_index)), &
1048 buffer(current_starting_index : target_end))
1049 current_starting_index=target_end+1
integer function get_total_number_of_fields(definition_descriptions, number_defns)
Retrieve the total number of fields, which is all the fields in all the data definitions.
logical io_server_enabled
Retrieves the key currently being held at a specific index in the map or "" if the index > map elemen...
Gets a specific generic element out of the list, stack, queue or map with the corresponding key...
Wrapper type for the value returned for a published field from a component.
Puts an integer key-value pair into the map.
integer function handle_component_field_array_packing_into_send_buffer(current_state, data_definition, field, current_buffer_point)
Packs a components field array into the send buffer, these are fields that are served up by component...
integer, parameter, public float_data_type
integer function send_general_monc_information_to_server(current_state, buffer)
Sends the general MONC information (ZN field and Q field names) to the IO server. ...
integer function, public get_mpi_datatype_from_internal_representation(type_code)
Gets the MPI datatype from out internal representation of the field data type (as in the configuratio...
integer, parameter, public log_error
Only log ERROR messages.
integer, parameter, public array_field_type
integer function, public get_max_number_q_indices()
Gets the maximum number of Q indicies.
Contains prognostic field definitions and functions.
integer, parameter, public boolean_data_type
character(len=string_length), parameter, public local_end_points_key
integer, parameter, public register_command
A prognostic field which is assumed to be 3D.
integer function send_data_field_sizes_to_server(current_state, mpi_type_data_sizing_description, data_description, number_unique_fields)
Assembles all the data field sizing information and sends this to the IO server.
Bridge between MONC and the IO server, this registers the current MONC process, will issue data dumps...
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
integer, parameter, public z_index
Grid index parameters.
integer function build_mpi_data_type_for_definition(specific_data_definition)
Builds the MPI data type for a specific definition with sizing information.
integer, parameter, public command_tag
integer function pack_prognostic_flow_field(buffer, prognostic, start_offset, local_grid)
Packs the data of a specific prognostic field into a buffer.
Contains common definitions for the data and datatypes used by MONC.
type(map_type) component_field_descriptions
The ModelState which represents the current state of a run.
subroutine, public log_master_log(level, message)
Will log just from the master process.
A hashmap structure, the same as a map but uses hashing for greatly improved performance when storing...
Conversion between common inbuilt FORTRAN data types.
integer, parameter, public double_data_type
character(len=string_length), parameter, public local_sizes_key
Converts data types to strings.
Description of a component.
integer, parameter, public single_precision
Single precision (32 bit) kind.
subroutine, public log_log(level, message, str)
Logs a message at the specified level. If the level is above the current level then the message is ig...
subroutine timestep_callback(current_state)
Model dump call back, called for each model dump phase.
type(map_type) sendable_fields
type(component_field_value_type) function, public get_component_field_value(current_state, name)
Retrieves the value wrapper of a components published field.
type(q_metadata_type) function, public get_indices_descriptor(i)
Retrieves the indicies descriptor at a specific location.
integer, parameter, public double_precision
Double precision (64 bit) kind.
subroutine package_local_monc_decomposition_into_descriptions(current_state, data_description)
Packages the local MONC decomposition information into descriptions for communication.
integer, parameter, public string_data_type
subroutine build_mpi_data_types()
Builds the MPI data types that correspond to the field descriptions and sizings.
This defines some constants and procedures that are useful to the IO server and clients that call it...
integer, parameter, public integer_data_type
Map data structure that holds string (length 20 maximum) key value pairs.
subroutine init_callback(current_state)
Initialisation call back, called at the start of the model run.
integer function, public pack_map_field(buffer, start_offset, map_to_pack)
Packs a map into the send buffer.
This manages the Q variables and specifically the mapping between names and the index that they are s...
Returns the number of elements in the collection.
type(component_field_information_type) function, public get_component_field_information(current_state, name)
Retrieves information about a components published field which includes its type and size...
subroutine pack_send_buffer(current_state, data_definition)
Packs the current state into the send buffer. This iterates through each field in the data descriptio...
integer function, public get_number_active_q_indices()
Gets the number of active Q indicies (i.e. those allocated to specific uses)
Interfaces and types that MONC components must specify.
integer function pack_scalar_into_send_buffer(current_state, data_definition, field, current_buffer_point)
Packs scalar fields into the send bufer.
subroutine register_with_io_server(current_state, mpi_type_definition_description, mpi_type_field_description)
Registers this MONC with the corresponding IO server. This will encapsulate the entire protocol...
Defined the local grid, i.e. the grid held on this process after decomposition.
Collection data structures.
type(component_descriptor_type) function, public iobridge_get_descriptor()
integer, parameter, public data_command_start
integer function pack_q_fields(buffer, q_fields, number_q_fields, start_offset, local_grid)
Packs the Q fields into the send buffer.
integer, parameter, public component_integer_data_type
integer, parameter, public log_warn
Log WARNING and ERROR messages.
type(map_type) unique_field_names
integer function handle_component_field_scalar_packing_into_send_buffer(current_state, data_definition, field, current_buffer_point)
Packs a components field scalar into the send buffer, these are fields that are served up by componen...
integer, parameter, public string_length
Default length of strings.
integer function, dimension(5), public populate_mpi_type_extents()
Provides the type extents of the types that we are using in construction of the MPI data type...
subroutine populate_globally_visible_sendable_fields(current_state)
Populates the globally visible sendable fields which is a key value pair mapping between name and des...
subroutine populate_component_public_field(current_state, field_name)
Populates the field information for a specific publically available field offered by one of the compo...
subroutine populate_sendable_fields(current_state)
Populates the sendable field definitions with the field sizing information.
List data structure which implements a doubly linked list. This list will preserve its order...
class(*) function, pointer generate_sendable_description(dim1, dim2, dim3, dim4)
Generates a sendable description based upon the dimension information supplied, missing arguments mea...
subroutine finalisation_callback(current_state)
Finalisation call back, called at the end of the model run.
subroutine send_monc_specific_data_to_server(current_state, mpi_type_data_sizing_description)
Sends this MONC specific information to the IO server, which is field info (sizing & availability) as...
integer function, public options_size(options_database)
Returns the number of entries in the options database.
Functionality to support the different types of grid and abstraction between global grids and local o...
type(list_type) function, public get_all_component_published_fields()
Retrieves all of the published field information.
integer function, public build_mpi_type_definition_description()
Builds the MPI data type for sending data descriptions to registree MONCs.
subroutine, public append_mpi_datatype(field_start, field_end, field_array_sizes, data_type, type_extents, prev_data_type, type_index, old_types, offsets, block_counts)
Appends the MPI datatype details to the block counts, old types and offsets arrays. This will lump together multiple concurrent fields with the same type.
integer function pack_map_into_send_buffer(current_state, data_definition, field, current_buffer_point)
Packs map fields into the send buffer.
integer function, public options_get_integer(options_database, key, index)
Retrieves an integer value from the database that matches the provided key.
Manages the options database. Contains administration functions and deduce runtime options from the c...
integer function, public pack_array_field(buffer, start_offset, int_array, real_array_1d, real_array_2d, real_array_3d, real_array_4d)
Packs an array field into the sending buffer.
logical function, public options_get_logical(options_database, key, index)
Retrieves a logical value from the database that matches the provided key.
Frees up all the allocatable, heap, memory associated with a list, stack, queue or map...
Puts a generic key-value pair into the map.
integer function pack_array_into_send_buffer(current_state, data_definition, field, current_buffer_point)
Packs array fields into the send bufer.
type(component_field_information_type) function get_component_field_descriptor(field_name)
Retrieves the descriptor associated with some component's field based upon the field name...
character(len=string_length), parameter, public number_q_indicies_key
subroutine populate_data_definition_configuration(definition_descriptions, number_defns, field_descriptions, number_fields)
Based upon the received data and field definitions this will configure the IO bridge internal represe...
Determines whether or not a map contains a specific key.
integer, parameter, public scalar_field_type
type(io_configuration_data_definition_type), dimension(:), allocatable data_definitions
type(io_server_sendable_field_sizing) function get_sendable_field_sizing(field_name, field_found)
Retrieves the sizing information associated with a specific field.
integer function, public build_mpi_type_data_sizing_description()
Builds the MPI type used for sending to the IO server a description of the data, namely the size of t...
integer function, public build_mpi_type_field_description()
Builds the MPI data type for sending field descriptions to registree MONCs.
The model state which represents the current state of a run.
integer, parameter, public map_field_type
Field data type identifiers.
logical in_finalisation_callback
integer, parameter, public y_index
integer, parameter, public data_tag
Gets a specific string element out of the list, stack, queue or map with the corresponding key...
subroutine assemble_individual_description(data_description, index, field_name, field_sizing_description)
Will assemble an individual description of an array data field.
integer function get_definition_index(name)
Looks up a specific definition based upon its name and returns the index.
integer, parameter, public x_index
subroutine send_data_to_io_server(current_state, data_index)
Sends data to the IO server.
integer, parameter, public deregister_command
integer function, public pack_scalar_field(buffer, start_offset, int_value, real_value, single_real_value, double_real_value, string_value, logical_value)
Packs the data of a scalar field into a buffer.
character(len=string_length), parameter, public local_start_points_key
integer, parameter, public component_double_data_type