26 module coupler_types_mod
29 use fms2_io_mod,
only:
register_axis, unlimited, variable_exists, check_if_open
30 use fms2_io_mod,
only:
register_field, get_num_dimensions, variable_att_exists
31 use fms2_io_mod,
only: get_variable_attribute, get_dimension_size, get_dimension_names
32 use fms2_io_mod,
only: register_variable_attribute, get_variable_dimension_names
33 use fms2_io_mod,
only: get_variable_num_dimensions
39 use fms_string_utils_mod,
only:
string
40 use platform_mod,
only: r4_kind, r8_kind, i8_kind, fms_file_len, fms_path_len
47 #include<file_version.h>
61 character(len=*),
parameter :: mod_name =
'coupler_types_mod'
77 character(len=48) :: name =
' '
78 logical :: mean = .true.
79 logical :: override = .false.
80 integer :: id_diag = 0
81 character(len=128) :: long_name =
' '
82 character(len=128) :: units =
' '
83 integer :: id_rest = 0
84 logical :: may_init = .true.
87 real(r8_kind),
pointer,
contiguous,
dimension(:,:,:) :: values => null()
95 character(len=48) :: name =
' '
96 integer :: num_fields = 0
98 character(len=128) :: flux_type =
' '
99 character(len=128) :: implementation =
' '
100 logical,
pointer,
dimension(:) :: flag => null()
101 integer :: atm_tr_index = 0
102 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
103 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
104 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
106 logical :: use_atm_pressure
107 logical :: use_10m_wind_speed
108 logical :: pass_through_ice
109 real(r8_kind),
pointer,
dimension(:) :: param => null()
110 real(r8_kind) :: mol_wt = 0.0_r8_kind
116 character(len=48) :: name =
' '
117 logical :: mean = .true.
118 logical :: override = .false.
119 integer :: id_diag = 0
120 character(len=128) :: long_name =
' '
121 character(len=128) :: units =
' '
122 integer :: id_rest = 0
123 logical :: may_init = .true.
126 real(r4_kind),
pointer,
contiguous,
dimension(:,:,:) :: values => null()
134 character(len=48) :: name =
' '
135 integer :: num_fields = 0
137 character(len=128) :: flux_type =
' '
138 character(len=128) :: implementation =
' '
139 logical,
pointer,
dimension(:) :: flag => null()
140 integer :: atm_tr_index = 0
141 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
142 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
143 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
145 logical :: use_atm_pressure
146 logical :: use_10m_wind_speed
147 logical :: pass_through_ice
151 real(r8_kind),
pointer,
dimension(:) :: param => null()
152 real(r8_kind) :: mol_wt = 0.0_r8_kind
158 integer :: num_bcs = 0
162 logical :: set = .false.
163 integer :: isd, isc, iec, ied
164 integer :: jsd, jsc, jec, jed
172 character(len=48) :: name =
' '
173 real(r8_kind),
pointer,
contiguous,
dimension(:,:) :: values => null()
176 logical :: mean = .true.
177 logical :: override = .false.
178 integer :: id_diag = 0
179 character(len=128) :: long_name =
' '
180 character(len=128) :: units =
' '
181 integer :: id_rest = 0
182 logical :: may_init = .true.
190 character(len=48) :: name =
' '
191 integer :: num_fields = 0
193 character(len=128) :: flux_type =
' '
194 character(len=128) :: implementation =
' '
195 real(r8_kind),
pointer,
dimension(:) :: param => null()
196 logical,
pointer,
dimension(:) :: flag => null()
197 integer :: atm_tr_index = 0
198 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
199 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
200 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
202 logical :: use_atm_pressure
203 logical :: use_10m_wind_speed
204 logical :: pass_through_ice
205 real(r8_kind) :: mol_wt = 0.0_r8_kind
211 character(len=44) :: name =
' '
212 real(r4_kind),
pointer,
contiguous,
dimension(:,:) :: values => null()
215 logical :: mean = .true.
216 logical :: override = .false.
217 integer :: id_diag = 0
218 character(len=124) :: long_name =
' '
219 character(len=124) :: units =
' '
220 integer :: id_rest = 0
221 logical :: may_init = .true.
229 character(len=44) :: name =
' '
230 integer :: num_fields = 0
232 character(len=124) :: flux_type =
' '
233 character(len=124) :: implementation =
' '
237 real(r8_kind),
pointer,
dimension(:) :: param => null()
238 logical,
pointer,
dimension(:) :: flag => null()
239 integer :: atm_tr_index = 0
240 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
241 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
242 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
244 logical :: use_atm_pressure
245 logical :: use_10m_wind_speed
246 logical :: pass_through_ice
247 real(r8_kind) :: mol_wt = 0.0_r8_kind
253 integer :: num_bcs = 0
258 logical :: set = .false.
259 integer :: isd, isc, iec, ied
260 integer :: jsd, jsc, jec, jed
266 character(len=48) :: name =
' '
267 real(r8_kind),
pointer,
dimension(:) :: values => null()
268 logical :: mean = .true.
269 logical :: override = .false.
270 integer :: id_diag = 0
271 character(len=128) :: long_name =
' '
272 character(len=128) :: units =
' '
273 logical :: may_init = .true.
281 character(len=48) :: name =
' '
282 integer :: num_fields = 0
284 character(len=128) :: flux_type =
' '
285 character(len=128) :: implementation =
' '
289 real(r8_kind),
pointer,
dimension(:) :: param => null()
290 logical,
pointer,
dimension(:) :: flag => null()
291 integer :: atm_tr_index = 0
292 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
293 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
294 logical :: use_atm_pressure
295 logical :: use_10m_wind_speed
296 logical :: pass_through_ice
300 real(r8_kind) :: mol_wt = 0.0_r8_kind
307 character(len=48) :: name =
' '
308 real(r4_kind),
pointer,
dimension(:) :: values => null()
309 logical :: mean = .true.
310 logical :: override = .false.
311 integer :: id_diag = 0
312 character(len=128) :: long_name =
' '
313 character(len=128) :: units =
' '
314 logical :: may_init = .true.
322 character(len=48) :: name =
' '
323 integer :: num_fields = 0
325 character(len=128) :: flux_type =
' '
326 character(len=128) :: implementation =
' '
330 real(r8_kind),
pointer,
dimension(:) :: param => null()
331 logical,
pointer,
dimension(:) :: flag => null()
332 integer :: atm_tr_index = 0
333 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
334 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
335 logical :: use_atm_pressure
336 logical :: use_10m_wind_speed
337 logical :: pass_through_ice
339 real(r8_kind) :: mol_wt = 0.0_r8_kind
346 integer :: num_bcs = 0
351 logical :: set = .false.
409 module procedure ct_rescale_data_2d_r4, ct_rescale_data_3d_r4
410 module procedure ct_rescale_data_2d_r8, ct_rescale_data_3d_r8
419 module procedure ct_increment_data_2d_3d_r4, ct_increment_data_2d_3d_r8
425 module procedure ct_extract_data_2d_r4, ct_extract_data_2d_r8
426 module procedure ct_extract_data_3d_r4, ct_extract_data_3d_r8
427 module procedure ct_extract_data_3d_2d_r4, ct_extract_data_3d_2d_r8
433 module procedure ct_set_data_2d_r4, ct_set_data_3d_r4, ct_set_data_2d_3d_r4
434 module procedure ct_set_data_2d_r8, ct_set_data_3d_r8, ct_set_data_2d_3d_r8
495 logical,
save :: module_is_initialized = .false.
498 if (module_is_initialized)
then
505 module_is_initialized = .true.
515 & diag_name, axes, time, suffix)
518 integer,
intent(in) :: is
519 integer,
intent(in) :: ie
520 integer,
intent(in) :: js
521 integer,
intent(in) :: je
522 character(len=*),
intent(in) :: diag_name
524 integer,
dimension(:),
intent(in) :: axes
526 character(len=*),
intent(in),
optional :: suffix
528 character(len=*),
parameter :: error_header =&
529 &
'==>Error from coupler_types_mod (coupler_type_copy_1d_2d):'
531 if (var_out%num_bcs > 0)
then
534 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
537 if (var_in%num_bcs >= 0)&
538 &
call ct_spawn_1d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
540 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
549 & diag_name, axes, time, suffix)
552 integer,
intent(in) :: is
553 integer,
intent(in) :: ie
554 integer,
intent(in) :: js
555 integer,
intent(in) :: je
556 integer,
intent(in) :: kd
557 character(len=*),
intent(in) :: diag_name
559 integer,
dimension(:),
intent(in) :: axes
561 character(len=*),
intent(in),
optional :: suffix
563 character(len=*),
parameter :: error_header =&
564 &
'==>Error from coupler_types_mod (coupler_type_copy_1d_3d):'
566 if (var_out%num_bcs > 0)
then
569 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
572 if (var_in%num_bcs >= 0)&
573 &
call ct_spawn_1d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
575 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
583 & diag_name, axes, time, suffix)
586 integer,
intent(in) :: is
587 integer,
intent(in) :: ie
588 integer,
intent(in) :: js
589 integer,
intent(in) :: je
590 character(len=*),
intent(in) :: diag_name
592 integer,
dimension(:),
intent(in) :: axes
594 character(len=*),
intent(in),
optional :: suffix
596 character(len=*),
parameter :: error_header =&
597 &
'==>Error from coupler_types_mod (coupler_type_copy_2d_2d):'
599 if (var_out%num_bcs > 0)
then
602 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
605 if (var_in%num_bcs >= 0)&
606 &
call ct_spawn_2d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
608 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
616 & diag_name, axes, time, suffix)
619 integer,
intent(in) :: is
620 integer,
intent(in) :: ie
621 integer,
intent(in) :: js
622 integer,
intent(in) :: je
623 integer,
intent(in) :: kd
624 character(len=*),
intent(in) :: diag_name
626 integer,
dimension(:),
intent(in) :: axes
628 character(len=*),
intent(in),
optional :: suffix
630 character(len=*),
parameter :: error_header =&
631 &
'==>Error from coupler_types_mod (coupler_type_copy_2d_3d):'
633 if (var_out%num_bcs > 0)
then
636 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
639 if (var_in%num_bcs >= 0)&
640 &
call ct_spawn_2d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
642 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
650 & diag_name, axes, time, suffix)
653 integer,
intent(in) :: is
654 integer,
intent(in) :: ie
655 integer,
intent(in) :: js
656 integer,
intent(in) :: je
657 character(len=*),
intent(in) :: diag_name
659 integer,
dimension(:),
intent(in) :: axes
661 character(len=*),
intent(in),
optional :: suffix
663 character(len=*),
parameter :: error_header =&
664 &
'==>Error from coupler_types_mod (coupler_type_copy_3d_2d):'
666 if (var_out%num_bcs > 0)
then
669 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
672 if (var_in%num_bcs >= 0)&
673 &
call ct_spawn_3d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
675 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
683 & diag_name, axes, time, suffix)
686 integer,
intent(in) :: is
687 integer,
intent(in) :: ie
688 integer,
intent(in) :: js
689 integer,
intent(in) :: je
690 integer,
intent(in) :: kd
691 character(len=*),
intent(in) :: diag_name
693 integer,
dimension(:),
intent(in) :: axes
695 character(len=*),
intent(in),
optional :: suffix
697 character(len=*),
parameter :: error_header =&
698 &
'==>Error from coupler_types_mod (coupler_type_copy_3d_3d):'
700 if (var_out%num_bcs > 0)
then
703 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
706 if (var_in%num_bcs >= 0)&
707 &
call ct_spawn_3d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
709 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
726 integer,
dimension(4),
intent(in) :: idim
728 integer,
dimension(4),
intent(in) :: jdim
730 character(len=*),
optional,
intent(in) :: suffix
731 logical,
optional,
intent(in) :: as_needed
734 character(len=*),
parameter :: error_header =&
735 &
'==>Error from coupler_types_mod (CT_spawn_1d_2d):'
736 character(len=400) :: error_msg
739 if (
present(as_needed))
then
741 if ((var%set) .or. (.not.var_in%set))
return
746 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
747 if (.not.var_in%set)&
748 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
751 if(var_in%num_bcs .gt. 0)
then
752 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
753 if(
associated(var_in%bc) )
then
754 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"//&
755 " only one should be associated per type.")
757 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"//&
758 " one must be associated to copy field data.")
763 var%num_bcs = var_in%num_bcs
766 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
767 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
770 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
771 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
774 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
775 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
777 if (var%num_bcs > 0)
then
778 if (
associated(var_in%bc))
then
779 if (
associated(var%bc))
then
780 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
782 allocate ( var%bc(var%num_bcs) )
783 do n = 1, var%num_bcs
784 var%bc(n)%name = var_in%bc(n)%name
785 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
786 var%bc(n)%flux_type = var_in%bc(n)%flux_type
787 var%bc(n)%implementation = var_in%bc(n)%implementation
788 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
789 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
790 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
791 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
792 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
793 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
794 var%bc(n)%num_fields = var_in%bc(n)%num_fields
795 if (
associated(var%bc(n)%field))
then
796 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
799 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
800 do m = 1, var%bc(n)%num_fields
801 if (
present(suffix))
then
802 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
804 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
806 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
807 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
808 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
809 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
810 if (
associated(var%bc(n)%field(m)%values))
then
811 write (error_msg, *) trim(error_header),&
812 &
' var%bc(', n,
')%field(', m,
')%values already associated'
816 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
817 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
820 else if(
associated(var_in%bc_r4))
then
821 if (
associated(var%bc_r4))
then
822 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
824 allocate ( var%bc_r4(var%num_bcs) )
825 do n = 1, var%num_bcs
826 var%bc_r4(n)%name = var_in%bc_r4(n)%name
827 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
828 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
829 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
830 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
831 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
832 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
833 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
834 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
835 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
836 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
837 if (
associated(var%bc_r4(n)%field))
then
838 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
841 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
842 do m = 1, var%bc_r4(n)%num_fields
843 if (
present(suffix))
then
844 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
846 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
848 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
849 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
850 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
851 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
852 if (
associated(var%bc_r4(n)%field(m)%values))
then
853 write (error_msg, *) trim(error_header),&
854 &
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
858 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
859 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
863 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
864 " pointers for both bc and bc_r4")
881 integer,
dimension(4),
intent(in) :: idim
883 integer,
dimension(4),
intent(in) :: jdim
885 integer,
dimension(2),
intent(in) :: kdim
887 character(len=*),
optional,
intent(in) :: suffix
888 logical,
optional,
intent(in) :: as_needed
891 character(len=*),
parameter :: error_header =&
892 &
'==>Error from coupler_types_mod (CT_spawn_1d_3d):'
893 character(len=400) :: error_msg
896 if (
present(as_needed))
then
898 if ((var%set) .or. (.not.var_in%set))
return
903 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
904 if (.not.var_in%set)&
905 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
908 if(var_in%num_bcs .gt. 0)
then
909 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
910 if(
associated(var_in%bc))
then
911 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
912 " only one should be associated per type")
914 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
915 " one must be associated to copy field data")
920 var%num_bcs = var_in%num_bcs
924 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
925 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
928 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
929 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
932 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
933 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
934 var%ks = kdim(1) ; var%ke = kdim(2)
936 if (var%num_bcs > 0)
then
937 if (kdim(1) > kdim(2))
then
938 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
941 if(
associated(var_in%bc))
then
942 if (
associated(var%bc))
then
943 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
945 allocate ( var%bc(var%num_bcs) )
946 do n = 1, var%num_bcs
947 var%bc(n)%name = var_in%bc(n)%name
948 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
949 var%bc(n)%flux_type = var_in%bc(n)%flux_type
950 var%bc(n)%implementation = var_in%bc(n)%implementation
951 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
952 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
953 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
954 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
955 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
956 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
957 var%bc(n)%num_fields = var_in%bc(n)%num_fields
958 if (
associated(var%bc(n)%field))
then
959 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
962 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
963 do m = 1, var%bc(n)%num_fields
964 if (
present(suffix))
then
965 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
967 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
969 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
970 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
971 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
972 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
973 if (
associated(var%bc(n)%field(m)%values))
then
974 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
978 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
979 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
982 else if(
associated(var_in%bc_r4))
then
983 if (
associated(var%bc_r4))
then
984 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
986 allocate ( var%bc_r4(var%num_bcs) )
987 do n = 1, var%num_bcs
988 var%bc_r4(n)%name = var_in%bc_r4(n)%name
989 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
990 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
991 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
992 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
993 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
994 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
995 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
996 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
997 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
998 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
999 if (
associated(var%bc_r4(n)%field))
then
1000 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1003 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1004 do m = 1, var%bc_r4(n)%num_fields
1005 if (
present(suffix))
then
1006 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1008 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1010 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1011 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1012 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1013 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1014 if (
associated(var%bc_r4(n)%field(m)%values))
then
1015 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1019 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1020 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1024 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1025 " pointers for both bc and bc_r4")
1043 integer,
dimension(4),
intent(in) :: idim
1045 integer,
dimension(4),
intent(in) :: jdim
1047 character(len=*),
optional,
intent(in) :: suffix
1048 logical,
optional,
intent(in) :: as_needed
1051 character(len=*),
parameter :: error_header =&
1052 &
'==>Error from coupler_types_mod (CT_spawn_2d_2d):'
1053 character(len=400) :: error_msg
1056 if (
present(as_needed))
then
1058 if ((var%set) .or. (.not.var_in%set))
return
1063 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1064 if (.not.var_in%set)&
1065 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1068 if(var_in%num_bcs .gt. 0)
then
1069 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1070 if(
associated(var_in%bc) )
then
1071 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1072 " only one should be associated per type")
1074 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1075 " one must be associated to copy field data")
1080 var%num_bcs = var_in%num_bcs
1083 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1084 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1087 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1088 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1091 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1092 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1094 if (var%num_bcs > 0)
then
1095 if(
associated(var_in%bc))
then
1096 if (
associated(var%bc))
then
1097 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1099 allocate ( var%bc(var%num_bcs) )
1100 do n = 1, var%num_bcs
1101 var%bc(n)%name = var_in%bc(n)%name
1102 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1103 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1104 var%bc(n)%implementation = var_in%bc(n)%implementation
1105 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1106 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1107 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1108 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1109 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1110 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1111 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1112 if (
associated(var%bc(n)%field))
then
1113 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1116 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1117 do m = 1, var%bc(n)%num_fields
1118 if (
present(suffix))
then
1119 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1121 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1123 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1124 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1125 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1126 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1127 if (
associated(var%bc(n)%field(m)%values))
then
1128 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1132 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1133 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
1136 else if (
associated(var_in%bc_r4))
then
1137 if (
associated(var%bc_r4))
then
1138 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1140 allocate ( var%bc_r4(var%num_bcs) )
1141 do n = 1, var%num_bcs
1142 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1143 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1144 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1145 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1146 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1147 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1148 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1149 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1150 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1151 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1152 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1153 if (
associated(var%bc_r4(n)%field))
then
1154 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1157 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1158 do m = 1, var%bc_r4(n)%num_fields
1159 if (
present(suffix))
then
1160 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1162 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1164 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1165 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1166 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1167 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1168 if (
associated(var%bc_r4(n)%field(m)%values))
then
1169 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1173 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1174 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
1178 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1179 " pointers for both bc and bc_r4")
1197 integer,
dimension(4),
intent(in) :: idim
1199 integer,
dimension(4),
intent(in) :: jdim
1201 integer,
dimension(2),
intent(in) :: kdim
1203 character(len=*),
optional,
intent(in) :: suffix
1204 logical,
optional,
intent(in) :: as_needed
1207 character(len=*),
parameter :: error_header =&
1208 &
'==>Error from coupler_types_mod (CT_spawn_2d_3d):'
1209 character(len=400) :: error_msg
1212 if (
present(as_needed))
then
1214 if ((var%set) .or. (.not.var_in%set))
return
1219 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1220 if (.not.var_in%set)&
1221 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1223 if(var_in%num_bcs .gt. 0)
then
1225 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1226 if(
associated(var_in%bc) )
then
1227 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1228 " only one should be associated per type")
1230 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1231 " one must be associated to copy field data")
1236 var%num_bcs = var_in%num_bcs
1240 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1241 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1244 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1245 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1248 if (kdim(1) > kdim(2))
then
1249 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
1252 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1253 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1254 var%ks = kdim(1) ; var%ke = kdim(2)
1256 if (var%num_bcs > 0)
then
1257 if(
associated(var_in%bc))
then
1258 if (
associated(var%bc))
then
1259 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1261 allocate ( var%bc(var%num_bcs) )
1262 do n = 1, var%num_bcs
1263 var%bc(n)%name = var_in%bc(n)%name
1264 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1265 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1266 var%bc(n)%implementation = var_in%bc(n)%implementation
1267 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1268 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1269 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1270 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1271 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1272 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1273 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1274 if (
associated(var%bc(n)%field))
then
1275 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1278 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1279 do m = 1, var%bc(n)%num_fields
1280 if (
present(suffix))
then
1281 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1283 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1285 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1286 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1287 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1288 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1289 if (
associated(var%bc(n)%field(m)%values))
then
1290 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1294 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1295 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
1298 else if(
associated(var_in%bc_r4))
then
1299 if (
associated(var%bc_r4))
then
1300 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1302 allocate ( var%bc_r4(var%num_bcs) )
1303 do n = 1, var%num_bcs
1304 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1305 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1306 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1307 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1308 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1309 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1310 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1311 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1312 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1313 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1314 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1315 if (
associated(var%bc_r4(n)%field))
then
1316 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1319 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1320 do m = 1, var%bc_r4(n)%num_fields
1321 if (
present(suffix))
then
1322 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1324 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1326 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1327 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1328 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1329 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1330 if (
associated(var%bc_r4(n)%field(m)%values))
then
1331 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1335 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1336 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1340 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1341 " pointers for both bc and bc_r4")
1358 integer,
dimension(4),
intent(in) :: idim
1360 integer,
dimension(4),
intent(in) :: jdim
1362 character(len=*),
optional,
intent(in) :: suffix
1363 logical,
optional,
intent(in) :: as_needed
1366 character(len=*),
parameter :: error_header =&
1367 &
'==>Error from coupler_types_mod (CT_spawn_3d_2d):'
1368 character(len=400) :: error_msg
1371 if (
present(as_needed))
then
1373 if ((var%set) .or. (.not.var_in%set))
return
1378 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1379 if (.not.var_in%set)&
1380 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1382 if(var_in%num_bcs .gt. 0)
then
1384 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1385 if(
associated(var_in%bc) )
then
1386 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1387 " only one should be associated per type")
1389 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1390 " one must be associated to copy field data")
1395 var%num_bcs = var_in%num_bcs
1398 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1399 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1402 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1403 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1406 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1407 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1409 if (var%num_bcs > 0)
then
1411 if(
associated(var_in%bc))
then
1412 if (
associated(var%bc))
then
1413 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1415 allocate ( var%bc(var%num_bcs) )
1416 do n = 1, var%num_bcs
1417 var%bc(n)%name = var_in%bc(n)%name
1418 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1419 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1420 var%bc(n)%implementation = var_in%bc(n)%implementation
1421 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1422 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1423 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1424 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1425 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1426 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1427 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1428 if (
associated(var%bc(n)%field))
then
1429 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1432 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1433 do m = 1, var%bc(n)%num_fields
1434 if (
present(suffix))
then
1435 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1437 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1439 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1440 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1441 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1442 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1443 if (
associated(var%bc(n)%field(m)%values))
then
1444 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1448 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1449 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
1453 else if (
associated(var_in%bc_r4))
then
1454 if (
associated(var%bc_r4))
then
1455 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1457 allocate ( var%bc_r4(var%num_bcs) )
1458 do n = 1, var%num_bcs
1459 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1460 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1461 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1462 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1463 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1464 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1465 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1466 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1467 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1468 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1469 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1470 if (
associated(var%bc_r4(n)%field))
then
1471 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1474 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1475 do m = 1, var%bc_r4(n)%num_fields
1476 if (
present(suffix))
then
1477 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1479 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1481 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1482 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1483 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1484 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1485 if (
associated(var%bc_r4(n)%field(m)%values))
then
1486 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1490 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1491 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
1495 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1496 " pointers for both bc and bc_r4")
1514 integer,
dimension(4),
intent(in) :: idim
1516 integer,
dimension(4),
intent(in) :: jdim
1518 integer,
dimension(2),
intent(in) :: kdim
1520 character(len=*),
optional,
intent(in) :: suffix
1521 logical,
optional,
intent(in) :: as_needed
1524 character(len=*),
parameter :: error_header =&
1525 &
'==>Error from coupler_types_mod (CT_spawn_3d_3d):'
1526 character(len=400) :: error_msg
1529 if (
present(as_needed))
then
1531 if ((var%set) .or. (.not.var_in%set))
return
1536 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1537 if (.not.var_in%set)&
1538 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1540 if(var_in%num_bcs .gt. 0)
then
1542 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1543 if(
associated(var_in%bc))
then
1544 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"//&
1545 "only one should be allocated per type")
1547 call mpp_error(fatal, error_header//
"var_in%bc and var%bc_r4 are both uninitialized,"//&
1548 " one must be associated to copy field data")
1553 var%num_bcs = var_in%num_bcs
1556 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1557 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1560 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1561 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1564 if (kdim(1) > kdim(2))
then
1565 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
1568 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1569 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1570 var%ks = kdim(1) ; var%ke = kdim(2)
1572 if (var%num_bcs > 0)
then
1573 if(
associated(var_in%bc))
then
1574 if (
associated(var%bc))
then
1575 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1577 allocate ( var%bc(var%num_bcs) )
1578 do n = 1, var%num_bcs
1579 var%bc(n)%name = var_in%bc(n)%name
1580 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1581 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1582 var%bc(n)%implementation = var_in%bc(n)%implementation
1583 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1584 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1585 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1586 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1587 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1588 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1589 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1590 if (
associated(var%bc(n)%field))
then
1591 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1594 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1595 do m = 1, var%bc(n)%num_fields
1596 if (
present(suffix))
then
1597 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1599 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1601 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1602 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1603 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1604 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1605 if (
associated(var%bc(n)%field(m)%values))
then
1606 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1611 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1612 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
1615 else if(
associated(var_in%bc_r4))
then
1616 if (
associated(var%bc_r4))
then
1617 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1619 allocate ( var%bc_r4(var%num_bcs) )
1620 do n = 1, var%num_bcs
1621 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1622 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1623 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1624 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1625 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1626 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1627 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1628 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1629 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1630 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1631 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1632 if (
associated(var%bc_r4(n)%field))
then
1633 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1636 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1637 do m = 1, var%bc_r4(n)%num_fields
1638 if (
present(suffix))
then
1639 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1641 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1643 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1644 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1645 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1646 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1647 if (
associated(var%bc_r4(n)%field(m)%values))
then
1648 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1653 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1654 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1658 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1659 " pointers for both bc and bc_r4")
1677 & exclude_flux_type, only_flux_type, pass_through_ice)
1680 integer,
optional,
intent(in) :: halo_size
1681 integer,
optional,
intent(in) :: bc_index
1683 integer,
optional,
intent(in) :: field_index
1685 character(len=*),
optional,
intent(in) :: exclude_flux_type
1687 character(len=*),
optional,
intent(in) :: only_flux_type
1689 logical,
optional,
intent(in) :: pass_through_ice
1692 integer :: i, j, m, n, n1, n2, halo, i_off, j_off
1695 if (
present(bc_index))
then
1696 if (bc_index > var_in%num_bcs)&
1697 &
call mpp_error(fatal,
"CT_copy_data_2d: bc_index is present and exceeds var_in%num_bcs.")
1698 if (
present(field_index))
then
1699 if(
associated(var_in%bc))
then
1700 if (field_index > var_in%bc(bc_index)%num_fields)&
1701 &
call mpp_error(fatal,
"CT_copy_data_2d: field_index is present and exceeds num_fields for" //&
1702 & trim(var_in%bc(bc_index)%name) )
1704 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
1705 &
call mpp_error(fatal,
"CT_copy_data_2d: field_index is present and exceeds num_fields for" //&
1706 & trim(var_in%bc_r4(bc_index)%name) )
1709 elseif (
present(field_index))
then
1710 call mpp_error(fatal,
"CT_copy_data_2d: bc_index must be present if field_index is present.")
1714 if (
present(halo_size)) halo = halo_size
1718 if (
present(bc_index))
then
1725 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
1726 &
call mpp_error(fatal,
"CT_copy_data_2d: There is an i-direction computational domain size mismatch.")
1727 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
1728 &
call mpp_error(fatal,
"CT_copy_data_2d: There is a j-direction computational domain size mismatch.")
1729 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
1730 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive i-direction halo size for the input structure.")
1731 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
1732 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive j-direction halo size for the input structure.")
1733 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
1734 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive i-direction halo size for the output structure.")
1735 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
1736 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive j-direction halo size for the output structure.")
1738 i_off = var_in%isc - var%isc
1739 j_off = var_in%jsc - var%jsc
1742 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
1743 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1744 if(
associated(var_in%bc) )
then
1745 call mpp_error(fatal,
"CT_copy_data_2d var_in%bc and var_in%bc_r4 are both initialized,"//&
1746 " only one should be associated per type")
1748 call mpp_error(fatal,
"CT_copy_data_2d var_in%bc and var_in%bc_r4 are both uninitialized,"//&
1749 " one must be associated to copy field data.")
1755 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
1758 if (copy_bc .and.
present(exclude_flux_type))&
1759 & copy_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
1760 if (copy_bc .and.
present(only_flux_type))&
1761 & copy_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
1762 if (copy_bc .and.
present(pass_through_ice))&
1763 & copy_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
1764 if (.not.copy_bc) cycle
1766 do m = 1, var%bc(n)%num_fields
1767 if (
present(field_index))
then
1768 if (m /= field_index) cycle
1770 if (
associated(var%bc(n)%field(m)%values) )
then
1771 do j=var%jsc-halo,var%jec+halo
1772 do i=var%isc-halo,var%iec+halo
1773 var%bc(n)%field(m)%values(i,j) = var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
1779 else if (
associated(var_in%bc_r4))
then
1782 if (copy_bc .and.
present(exclude_flux_type))&
1783 & copy_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
1784 if (copy_bc .and.
present(only_flux_type))&
1785 & copy_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
1786 if (copy_bc .and.
present(pass_through_ice))&
1787 & copy_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
1788 if (.not.copy_bc) cycle
1790 do m = 1, var%bc_r4(n)%num_fields
1791 if (
present(field_index))
then
1792 if (m /= field_index) cycle
1794 if (
associated(var%bc_r4(n)%field(m)%values) )
then
1795 do j=var%jsc-halo,var%jec+halo
1796 do i=var%isc-halo,var%iec+halo
1797 var%bc_r4(n)%field(m)%values(i,j) = var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
1804 call mpp_error(fatal,
"CT_copy_data_2d: passed in type has unassociated coupler_field_type"// &
1805 " pointers for both bc and bc_r4")
1824 & exclude_flux_type, only_flux_type, pass_through_ice)
1827 integer,
optional,
intent(in) :: halo_size
1828 integer,
optional,
intent(in) :: bc_index
1830 integer,
optional,
intent(in) :: field_index
1832 character(len=*),
optional,
intent(in) :: exclude_flux_type
1834 character(len=*),
optional,
intent(in) :: only_flux_type
1836 logical,
optional,
intent(in) :: pass_through_ice
1839 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, k_off
1841 if (
present(bc_index))
then
1842 if (bc_index > var_in%num_bcs) &
1843 call mpp_error(fatal,
"CT_copy_data_3d: bc_index is present and exceeds var_in%num_bcs.")
1844 if (
present(field_index))
then
1845 if(
associated(var_in%bc))
then
1846 if (field_index > var_in%bc(bc_index)%num_fields)&
1847 &
call mpp_error(fatal,
"CT_copy_data_3d: field_index is present and exceeds num_fields for" //&
1848 & trim(var_in%bc(bc_index)%name) )
1850 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
1851 &
call mpp_error(fatal,
"CT_copy_data_3d: field_index is present and exceeds num_fields for" //&
1852 & trim(var_in%bc_r4(bc_index)%name) )
1855 elseif (
present(field_index))
then
1856 call mpp_error(fatal,
"CT_copy_data_3d: bc_index must be present if field_index is present.")
1860 if (
present(halo_size)) halo = halo_size
1864 if (
present(bc_index))
then
1871 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
1872 &
call mpp_error(fatal,
"CT_copy_data_3d: There is an i-direction computational domain size mismatch.")
1873 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
1874 &
call mpp_error(fatal,
"CT_copy_data_3d: There is a j-direction computational domain size mismatch.")
1875 if ((var_in%ke-var_in%ks) /= (var%ke-var%ks))&
1876 &
call mpp_error(fatal,
"CT_copy_data_3d: There is a k-direction computational domain size mismatch.")
1877 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
1878 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive i-direction halo size for the input structure.")
1879 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
1880 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive j-direction halo size for the input structure.")
1881 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
1882 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive i-direction halo size for the output structure.")
1883 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
1884 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive j-direction halo size for the output structure.")
1886 i_off = var_in%isc - var%isc
1887 j_off = var_in%jsc - var%jsc
1888 k_off = var_in%ks - var%ks
1891 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
1892 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1893 if(
associated(var_in%bc) )
then
1894 call mpp_error(fatal,
"CT_copy_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
1895 " only one should be associated per type")
1897 call mpp_error(fatal,
"CT_copy_data_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
1898 " one must be associated to copy field data.")
1904 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
1907 if (copy_bc .and.
present(exclude_flux_type))&
1908 & copy_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
1909 if (copy_bc .and.
present(only_flux_type))&
1910 & copy_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
1911 if (copy_bc .and.
present(pass_through_ice))&
1912 & copy_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
1913 if (.not.copy_bc) cycle
1915 do m = 1, var_in%bc(n)%num_fields
1916 if (
present(field_index))
then
1917 if (m /= field_index) cycle
1919 if (
associated(var%bc(n)%field(m)%values) )
then
1921 do j=var%jsc-halo,var%jec+halo
1922 do i=var%isc-halo,var%iec+halo
1923 var%bc(n)%field(m)%values(i,j,k) = var_in%bc(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
1930 else if (
associated(var_in%bc_r4))
then
1933 if (copy_bc .and.
present(exclude_flux_type))&
1934 & copy_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
1935 if (copy_bc .and.
present(only_flux_type))&
1936 & copy_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
1937 if (copy_bc .and.
present(pass_through_ice))&
1938 & copy_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
1939 if (.not.copy_bc) cycle
1941 do m = 1, var_in%bc_r4(n)%num_fields
1942 if (
present(field_index))
then
1943 if (m /= field_index) cycle
1945 if (
associated(var%bc_r4(n)%field(m)%values) )
then
1947 do j=var%jsc-halo,var%jec+halo
1948 do i=var%isc-halo,var%iec+halo
1949 var%bc_r4(n)%field(m)%values(i,j,k) = var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
1957 call mpp_error(fatal,
"CT_copy_data_3d: passed in type has unassociated coupler_field_type"// &
1958 " pointers for both bc and bc_r4")
1976 & exclude_flux_type, only_flux_type, pass_through_ice,&
1977 & ind3_start, ind3_end)
1980 integer,
optional,
intent(in) :: halo_size
1981 integer,
optional,
intent(in) :: bc_index
1983 integer,
optional,
intent(in) :: field_index
1985 character(len=*),
optional,
intent(in) :: exclude_flux_type
1987 character(len=*),
optional,
intent(in) :: only_flux_type
1989 logical,
optional,
intent(in) :: pass_through_ice
1991 integer,
optional,
intent(in) :: ind3_start
1993 integer,
optional,
intent(in) :: ind3_end
1997 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, ks, ke
1999 if (
present(bc_index))
then
2000 if (bc_index > var_in%num_bcs)&
2001 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: bc_index is present and exceeds var_in%num_bcs.")
2002 if (
present(field_index))
then ;
if (field_index > var_in%bc(bc_index)%num_fields)&
2003 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: field_index is present and exceeds num_fields for" //&
2004 & trim(var_in%bc(bc_index)%name) )
2006 elseif (
present(field_index))
then
2007 call mpp_error(fatal,
"CT_copy_data_2d_3d: bc_index must be present if field_index is present.")
2011 if (
present(halo_size)) halo = halo_size
2015 if (
present(bc_index))
then
2022 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2023 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: There is an i-direction computational domain size mismatch.")
2024 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2025 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: There is a j-direction computational domain size mismatch.")
2026 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2027 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive i-direction halo size for the input structure.")
2028 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2029 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive j-direction halo size for the input structure.")
2030 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2031 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive i-direction halo size for the output structure.")
2032 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2033 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive j-direction halo size for the output structure.")
2036 i_off = var_in%isc - var%isc
2037 j_off = var_in%jsc - var%jsc
2039 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2040 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2041 if(
associated(var_in%bc) )
then
2042 call mpp_error(fatal,
"CT_copy_data_2d_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2043 " only one should be associated per type")
2045 call mpp_error(fatal,
"CT_copy_data_2d_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
2046 " one must be associated to copy field data.")
2053 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2056 if (copy_bc .and.
present(exclude_flux_type))&
2057 & copy_bc = .not.(trim(var_in%bc(n)%flux_type) == trim(exclude_flux_type))
2058 if (copy_bc .and.
present(only_flux_type))&
2059 & copy_bc = (trim(var_in%bc(n)%flux_type) == trim(only_flux_type))
2060 if (copy_bc .and.
present(pass_through_ice))&
2061 & copy_bc = (pass_through_ice .eqv. var_in%bc(n)%pass_through_ice)
2062 if (.not.copy_bc) cycle
2064 do m = 1, var_in%bc(n)%num_fields
2065 if (
present(field_index))
then
2066 if (m /= field_index) cycle
2068 if (
associated(var%bc(n)%field(m)%values) )
then
2070 if (
present(ind3_start)) ks = max(ks, ind3_start)
2072 if (
present(ind3_end)) ke = max(ke, ind3_end)
2074 do j=var%jsc-halo,var%jec+halo
2075 do i=var%isc-halo,var%iec+halo
2076 var%bc(n)%field(m)%values(i,j,k) = var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
2084 else if (
associated(var_in%bc_r4))
then
2087 if (copy_bc .and.
present(exclude_flux_type))&
2088 & copy_bc = .not.(trim(var_in%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2089 if (copy_bc .and.
present(only_flux_type))&
2090 & copy_bc = (trim(var_in%bc_r4(n)%flux_type) == trim(only_flux_type))
2091 if (copy_bc .and.
present(pass_through_ice))&
2092 & copy_bc = (pass_through_ice .eqv. var_in%bc_r4(n)%pass_through_ice)
2093 if (.not.copy_bc) cycle
2095 do m = 1, var_in%bc_r4(n)%num_fields
2096 if (
present(field_index))
then
2097 if (m /= field_index) cycle
2099 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2101 if (
present(ind3_start)) ks = max(ks, ind3_start)
2103 if (
present(ind3_end)) ke = max(ke, ind3_end)
2105 do j=var%jsc-halo,var%jec+halo
2106 do i=var%isc-halo,var%iec+halo
2107 var%bc_r4(n)%field(m)%values(i,j,k) = var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
2115 call mpp_error(fatal,
"CT_copy_data_2d_3d: passed in type has unassociated coupler_field_type"// &
2116 " pointers for both bc and bc_r4")
2130 type(
domain2d),
intent(in) :: domain_in
2132 type(
domain2d),
intent(in) :: domain_out
2133 logical,
optional,
intent(in) :: complete
2135 real(r4_kind),
pointer,
dimension(:,:) :: null_ptr2D_r4 => null()
2136 real(r8_kind),
pointer,
dimension(:,:) :: null_ptr2D_r8 => null()
2137 logical :: do_in, do_out, do_complete
2138 integer :: m, n, fc, fc_in, fc_out
2140 do_complete = .true.
2141 if (
present(complete)) do_complete = complete
2145 do_out = var_out%set
2147 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2148 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2149 if(
associated(var_in%bc) )
then
2150 call mpp_error(fatal,
"CT_redistribute_data_2d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2151 " only one should be associated per type")
2153 call mpp_error(fatal,
"CT_redistribute_data_2d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2154 " only one must be associated per type to redistribute field data.")
2160 if(
associated(var_in%bc) .or.
associated(var_out%bc) .or. var_in%num_bcs .lt. 1)
then
2161 fc_in = 0 ; fc_out = 0
2163 do n = 1, var_in%num_bcs
2164 do m = 1, var_in%bc(n)%num_fields
2165 if (
associated(var_in%bc(n)%field(m)%values)) fc_in = fc_in + 1
2169 if (fc_in == 0) do_in = .false.
2171 do n = 1, var_out%num_bcs
2172 do m = 1, var_out%bc(n)%num_fields
2173 if (
associated(var_out%bc(n)%field(m)%values)) fc_out = fc_out + 1
2177 if (fc_out == 0) do_out = .false.
2179 if (do_in .and. do_out)
then
2180 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2181 &
"Mismatch in num_bcs in CT_copy_data_2d.")
2182 if (fc_in /= fc_out)
call mpp_error(fatal,&
2183 &
"Mismatch in the total number of fields in CT_redistribute_data_2d.")
2186 if (.not.(do_in .or. do_out))
return
2189 if (do_in .and. do_out)
then
2190 do n = 1, var_in%num_bcs
2191 do m = 1, var_in%bc(n)%num_fields
2192 if (
associated(var_in%bc(n)%field(m)%values) .neqv.&
2193 &
associated(var_out%bc(n)%field(m)%values) ) &
2195 &
"CT_redistribute_data_2d: Mismatch in which var_in and var_out fields are associated"// &
2196 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2197 if (
associated(var_in%bc(n)%field(m)%values) )
then
2200 & domain_out, var_out%bc(n)%field(m)%values,&
2201 & complete=(do_complete.and.(fc==fc_in)) )
2206 do n = 1, var_in%num_bcs
2207 do m = 1, var_in%bc(n)%num_fields
2208 if (
associated(var_in%bc(n)%field(m)%values) )
then
2211 & domain_out, null_ptr2d_r8,&
2212 & complete=(do_complete.and.(fc==fc_in)) )
2216 elseif (do_out)
then
2217 do n = 1, var_out%num_bcs
2218 do m = 1, var_out%bc(n)%num_fields
2219 if (
associated(var_out%bc(n)%field(m)%values) )
then
2222 & domain_out, var_out%bc(n)%field(m)%values,&
2223 & complete=(do_complete.and.(fc==fc_out)) )
2229 else if(
associated(var_in%bc_r4) .or.
associated(var_out%bc_r4))
then
2230 fc_in = 0 ; fc_out = 0
2232 do n = 1, var_in%num_bcs
2233 do m = 1, var_in%bc_r4(n)%num_fields
2234 if (
associated(var_in%bc_r4(n)%field(m)%values)) fc_in = fc_in + 1
2238 if (fc_in == 0) do_in = .false.
2240 do n = 1, var_out%num_bcs
2241 do m = 1, var_out%bc_r4(n)%num_fields
2242 if (
associated(var_out%bc_r4(n)%field(m)%values)) fc_out = fc_out + 1
2246 if (fc_out == 0) do_out = .false.
2248 if (do_in .and. do_out)
then
2249 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2250 &
"Mismatch in num_bcs in CT_copy_data_2d.")
2251 if (fc_in /= fc_out)
call mpp_error(fatal,&
2252 &
"Mismatch in the total number of fields in CT_redistribute_data_2d.")
2255 if (.not.(do_in .or. do_out))
return
2258 if (do_in .and. do_out)
then
2259 do n = 1, var_in%num_bcs
2260 do m = 1, var_in%bc_r4(n)%num_fields
2261 if (
associated(var_in%bc_r4(n)%field(m)%values) .neqv.&
2262 &
associated(var_out%bc_r4(n)%field(m)%values) ) &
2264 &
"CT_redistribute_data_2d: Mismatch in which var_in and var_out fields are associated"// &
2265 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2266 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2269 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2270 & complete=(do_complete.and.(fc==fc_in)) )
2275 do n = 1, var_in%num_bcs
2276 do m = 1, var_in%bc_r4(n)%num_fields
2277 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2280 & domain_out, null_ptr2d_r4,&
2281 & complete=(do_complete.and.(fc==fc_in)) )
2285 elseif (do_out)
then
2286 do n = 1, var_out%num_bcs
2287 do m = 1, var_out%bc_r4(n)%num_fields
2288 if (
associated(var_out%bc_r4(n)%field(m)%values) )
then
2291 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2292 & complete=(do_complete.and.(fc==fc_out)) )
2298 call mpp_error(fatal,
"CT_redistribute_data_2d: passed in type has unassociated coupler_field_type"// &
2299 " pointers for both bc and bc_r4")
2309 type(
domain2d),
intent(in) :: domain_in
2311 type(
domain2d),
intent(in) :: domain_out
2312 logical,
optional,
intent(in) :: complete
2314 real(r4_kind),
pointer,
dimension(:,:,:) :: null_ptr3D_r4 => null()
2315 real(r8_kind),
pointer,
dimension(:,:,:) :: null_ptr3D_r8 => null()
2316 logical :: do_in, do_out, do_complete
2317 integer :: m, n, fc, fc_in, fc_out
2319 do_complete = .true.
2320 if (
present(complete)) do_complete = complete
2324 do_out = var_out%set
2329 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2330 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2331 if(
associated(var_in%bc) )
then
2332 call mpp_error(fatal,
"CT_redistribute_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2333 " only one should be associated per type")
2335 call mpp_error(fatal,
"CT_redistribute_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2336 " only one must be associated per type to redistribute field data.")
2342 if(
associated(var_in%bc) .or.
associated(var_out%bc) .or. var_in%num_bcs .lt. 1)
then
2344 do n = 1, var_in%num_bcs
2345 do m = 1, var_in%bc(n)%num_fields
2346 if (
associated(var_in%bc(n)%field(m)%values)) fc_in = fc_in + 1
2350 if (fc_in == 0) do_in = .false.
2352 do n = 1, var_out%num_bcs
2353 do m = 1, var_out%bc(n)%num_fields
2354 if (
associated(var_out%bc(n)%field(m)%values)) fc_out = fc_out + 1
2358 if (fc_out == 0) do_out = .false.
2360 if (do_in .and. do_out)
then
2361 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2362 &
"Mismatch in num_bcs in CT_copy_data_3d.")
2363 if (fc_in /= fc_out)
call mpp_error(fatal,&
2364 &
"Mismatch in the total number of fields in CT_redistribute_data_3d.")
2367 if (.not.(do_in .or. do_out))
return
2370 if (do_in .and. do_out)
then
2371 do n = 1, var_in%num_bcs
2372 do m = 1, var_in%bc(n)%num_fields
2373 if (
associated(var_in%bc(n)%field(m)%values) .neqv.&
2374 &
associated(var_out%bc(n)%field(m)%values) )&
2376 &
"CT_redistribute_data_3d: Mismatch in which var_in and var_out fields are associated"// &
2377 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2378 if (
associated(var_in%bc(n)%field(m)%values) )
then
2381 & domain_out, var_out%bc(n)%field(m)%values,&
2382 & complete=(do_complete.and.(fc==fc_in)) )
2387 do n = 1, var_in%num_bcs
2388 do m = 1, var_in%bc(n)%num_fields
2389 if (
associated(var_in%bc(n)%field(m)%values) )
then
2392 & domain_out, null_ptr3d_r8,&
2393 & complete=(do_complete.and.(fc==fc_in)) )
2397 elseif (do_out)
then
2398 do n = 1, var_out%num_bcs
2399 do m = 1, var_out%bc(n)%num_fields
2400 if (
associated(var_out%bc(n)%field(m)%values) )
then
2403 & domain_out, var_out%bc(n)%field(m)%values,&
2404 & complete=(do_complete.and.(fc==fc_out)) )
2410 else if(
associated(var_in%bc_r4) .or.
associated(var_out%bc_r4))
then
2412 do n = 1, var_in%num_bcs
2413 do m = 1, var_in%bc_r4(n)%num_fields
2414 if (
associated(var_in%bc_r4(n)%field(m)%values)) fc_in = fc_in + 1
2418 if (fc_in == 0) do_in = .false.
2420 do n = 1, var_out%num_bcs
2421 do m = 1, var_out%bc_r4(n)%num_fields
2422 if (
associated(var_out%bc_r4(n)%field(m)%values)) fc_out = fc_out + 1
2426 if (fc_out == 0) do_out = .false.
2428 if (do_in .and. do_out)
then
2429 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2430 &
"Mismatch in num_bcs in CT_copy_data_3d.")
2431 if (fc_in /= fc_out)
call mpp_error(fatal,&
2432 &
"Mismatch in the total number of fields in CT_redistribute_data_3d.")
2435 if (.not.(do_in .or. do_out))
return
2438 if (do_in .and. do_out)
then
2439 do n = 1, var_in%num_bcs
2440 do m = 1, var_in%bc_r4(n)%num_fields
2441 if (
associated(var_in%bc_r4(n)%field(m)%values) .neqv.&
2442 &
associated(var_out%bc_r4(n)%field(m)%values) )&
2444 &
"CT_redistribute_data_3d: Mismatch in which var_in and var_out fields are associated"// &
2445 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2446 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2449 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2450 & complete=(do_complete.and.(fc==fc_in)) )
2455 do n = 1, var_in%num_bcs
2456 do m = 1, var_in%bc_r4(n)%num_fields
2457 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2460 & domain_out, null_ptr3d_r4,&
2461 & complete=(do_complete.and.(fc==fc_in)) )
2465 elseif (do_out)
then
2466 do n = 1, var_out%num_bcs
2467 do m = 1, var_out%bc_r4(n)%num_fields
2468 if (
associated(var_out%bc_r4(n)%field(m)%values) )
then
2471 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2472 & complete=(do_complete.and.(fc==fc_out)) )
2478 call mpp_error(fatal,
"CT_redistribute_data_3d: passed in type has unassociated coupler_field_type"// &
2479 " pointers for both bc and bc_r4")
2499 & scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
2502 integer,
optional,
intent(in) :: halo_size
2503 integer,
optional,
intent(in) :: bc_index
2505 integer,
optional,
intent(in) :: field_index
2507 real(r8_kind),
optional,
intent(in) :: scale_factor
2508 real(r8_kind),
optional,
intent(in) :: scale_prev
2509 character(len=*),
optional,
intent(in) :: exclude_flux_type
2511 character(len=*),
optional,
intent(in) :: only_flux_type
2513 logical,
optional,
intent(in) :: pass_through_ice
2516 real(r8_kind) :: scale, sc_prev
2517 logical :: increment_bc
2518 integer :: i, j, m, n, n1, n2, halo, i_off, j_off
2521 if (
present(scale_factor)) scale = scale_factor
2522 sc_prev = 1.0_r8_kind
2523 if (
present(scale_prev)) sc_prev = scale_prev
2525 if (
present(bc_index))
then
2526 if (bc_index > var_in%num_bcs)&
2527 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: bc_index is present and exceeds var_in%num_bcs.")
2528 if (
present(field_index))
then
2529 if(
associated(var_in%bc))
then
2530 if (field_index > var_in%bc(bc_index)%num_fields)&
2531 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: field_index is present and exceeds num_fields for" //&
2532 & trim(var_in%bc(bc_index)%name) )
2534 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
2535 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: field_index is present and exceeds num_fields for" //&
2536 & trim(var_in%bc_r4(bc_index)%name) )
2539 elseif (
present(field_index))
then
2540 call mpp_error(fatal,
"CT_increment_data_2d_2d: bc_index must be present if field_index is present.")
2544 if (
present(halo_size)) halo = halo_size
2548 if (
present(bc_index))
then
2555 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2556 &
call mpp_error(fatal,
"CT_increment_data_2d: There is an i-direction computational domain size mismatch.")
2557 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2558 &
call mpp_error(fatal,
"CT_increment_data_2d: There is a j-direction computational domain size mismatch.")
2559 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2560 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive i-direction halo size for the input structure.")
2561 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2562 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive j-direction halo size for the input structure.")
2563 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2564 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive i-direction halo size for the output structure.")
2565 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2566 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive j-direction halo size for the output structure.")
2568 i_off = var_in%isc - var%isc
2569 j_off = var_in%jsc - var%jsc
2573 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2574 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2575 if(
associated(var_in%bc) )
then
2576 call mpp_error(fatal,
"CT_increment_data_2d_2d: var_in%bc and var_in%bc_r4 are both initialized,"// &
2577 " only one should be associated per type")
2579 call mpp_error(fatal,
"CT_increment_data_2d_2d: var_in%bc and var_in%bc_r4 are both initialized,"// &
2580 " only one must be associated per type to increment field data.")
2586 if(
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2588 increment_bc = .true.
2589 if (increment_bc .and.
present(exclude_flux_type))&
2590 & increment_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
2591 if (increment_bc .and.
present(only_flux_type))&
2592 & increment_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
2593 if (increment_bc .and.
present(pass_through_ice))&
2594 & increment_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
2595 if (.not.increment_bc) cycle
2597 do m = 1, var_in%bc(n)%num_fields
2598 if (
present(field_index))
then
2599 if (m /= field_index) cycle
2601 if (
associated(var%bc(n)%field(m)%values) )
then
2602 do j=var%jsc-halo,var%jec+halo
2603 do i=var%isc-halo,var%iec+halo
2604 var%bc(n)%field(m)%values(i,j) = sc_prev * var%bc(n)%field(m)%values(i,j) +&
2605 & scale * var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
2611 else if(
associated(var_in%bc_r4))
then
2613 increment_bc = .true.
2614 if (increment_bc .and.
present(exclude_flux_type))&
2615 & increment_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2616 if (increment_bc .and.
present(only_flux_type))&
2617 & increment_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
2618 if (increment_bc .and.
present(pass_through_ice))&
2619 & increment_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
2620 if (.not.increment_bc) cycle
2622 do m = 1, var_in%bc_r4(n)%num_fields
2623 if (
present(field_index))
then
2624 if (m /= field_index) cycle
2626 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2627 do j=var%jsc-halo,var%jec+halo
2628 do i=var%isc-halo,var%iec+halo
2629 var%bc_r4(n)%field(m)%values(i,j) = real(sc_prev,r4_kind) * var%bc_r4(n)%field(m)%values(i,j) +&
2630 & real(scale,r4_kind) * var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
2637 call mpp_error(fatal,
"CT_increment_data_2d_2d: passed in type has unassociated coupler_field_type"// &
2638 " pointers for both bc and bc_r4")
2658 & scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
2661 integer,
optional,
intent(in) :: halo_size
2662 integer,
optional,
intent(in) :: bc_index
2664 integer,
optional,
intent(in) :: field_index
2666 real(r8_kind),
optional,
intent(in) :: scale_factor
2667 real(r8_kind),
optional,
intent(in) :: scale_prev
2668 character(len=*),
optional,
intent(in) :: exclude_flux_type
2670 character(len=*),
optional,
intent(in) :: only_flux_type
2672 logical,
optional,
intent(in) :: pass_through_ice
2675 real(r8_kind) :: scale, sc_prev
2676 logical :: increment_bc
2677 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, k_off
2680 if (
present(scale_factor)) scale = scale_factor
2681 sc_prev = 1.0_r8_kind
2682 if (
present(scale_prev)) sc_prev = scale_prev
2684 if (
present(bc_index))
then
2685 if (bc_index > var_in%num_bcs)&
2686 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: bc_index is present and exceeds var_in%num_bcs.")
2687 if(
associated(var_in%bc))
then
2688 if (
present(field_index))
then ;
if (field_index > var_in%bc(bc_index)%num_fields)&
2689 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: field_index is present and exceeds num_fields for" //&
2690 & trim(var_in%bc(bc_index)%name) )
2692 else if(
associated(var_in%bc_r4))
then
2693 if (
present(field_index))
then ;
if (field_index > var_in%bc_r4(bc_index)%num_fields)&
2694 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: field_index is present and exceeds num_fields for" //&
2695 & trim(var_in%bc_r4(bc_index)%name) )
2698 elseif (
present(field_index))
then
2699 call mpp_error(fatal,
"CT_increment_data_3d_3d: bc_index must be present if field_index is present.")
2703 if (
present(halo_size)) halo = halo_size
2707 if (
present(bc_index))
then
2714 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2715 &
call mpp_error(fatal,
"CT_increment_data_3d: There is an i-direction computational domain size mismatch.")
2716 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2717 &
call mpp_error(fatal,
"CT_increment_data_3d: There is a j-direction computational domain size mismatch.")
2718 if ((var_in%ke-var_in%ks) /= (var%ke-var%ks))&
2719 &
call mpp_error(fatal,
"CT_increment_data_3d: There is a k-direction computational domain size mismatch.")
2720 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2721 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive i-direction halo size for the input structure.")
2722 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2723 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive j-direction halo size for the input structure.")
2724 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2725 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive i-direction halo size for the output structure.")
2726 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2727 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive j-direction halo size for the output structure.")
2729 i_off = var_in%isc - var%isc
2730 j_off = var_in%jsc - var%jsc
2731 k_off = var_in%ks - var%ks
2735 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2736 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2737 if(
associated(var_in%bc) )
then
2738 call mpp_error(fatal,
"CT_increment_data_3d_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2739 "only one should be associated per type")
2741 call mpp_error(fatal,
"CT_increment_data_3d_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
2742 " only one must be associated per type to increment field data.")
2748 if(
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2750 increment_bc = .true.
2751 if (increment_bc .and.
present(exclude_flux_type))&
2752 & increment_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
2753 if (increment_bc .and.
present(only_flux_type))&
2754 & increment_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
2755 if (increment_bc .and.
present(pass_through_ice))&
2756 & increment_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
2757 if (.not.increment_bc) cycle
2759 do m = 1, var_in%bc(n)%num_fields
2760 if (
present(field_index))
then
2761 if (m /= field_index) cycle
2763 if (
associated(var%bc(n)%field(m)%values) )
then
2765 do j=var%jsc-halo,var%jec+halo
2766 do i=var%isc-halo,var%iec+halo
2767 var%bc(n)%field(m)%values(i,j,k) = sc_prev * var%bc(n)%field(m)%values(i,j,k) +&
2768 & scale * var_in%bc(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
2775 else if(
associated(var_in%bc_r4))
then
2777 increment_bc = .true.
2778 if (increment_bc .and.
present(exclude_flux_type))&
2779 & increment_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2780 if (increment_bc .and.
present(only_flux_type))&
2781 & increment_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
2782 if (increment_bc .and.
present(pass_through_ice))&
2783 & increment_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
2784 if (.not.increment_bc) cycle
2786 do m = 1, var_in%bc_r4(n)%num_fields
2787 if (
present(field_index))
then
2788 if (m /= field_index) cycle
2790 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2792 do j=var%jsc-halo,var%jec+halo
2793 do i=var%isc-halo,var%iec+halo
2794 var%bc_r4(n)%field(m)%values(i,j,k) = real(sc_prev,r4_kind) * var%bc_r4(n)%field(m)%values(i,j,k) +&
2795 & real(scale,r4_kind) * var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
2803 call mpp_error(fatal,
"CT_increment_data_3d_3d: passed in type has unassociated coupler_field_type"// &
2804 " pointers for both bc and bc_r4")
2813 character(len=*),
intent(in) :: diag_name
2815 integer,
dimension(:),
intent(in) :: axes
2820 if (diag_name ==
' ')
return
2822 if (
size(axes) < 2)
then
2823 call mpp_error(fatal,
'==>Error from coupler_types_mod' //&
2824 &
'(coupler_types_set_diags_3d): axes has less than 2 elements')
2827 if(var%set .and. var%num_bcs .gt. 0)
then
2828 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2829 if(
associated(var%bc) )
then
2830 call mpp_error(fatal,
"CT_set_diags_2d: var%bc and var%bc_r4 are both initialized,"//&
2831 "only one should be associated per type")
2833 call mpp_error(fatal,
"CT_set_diags_2d: var%bc and var%bc_r4 are both initialized,"//&
2834 "one should be associated per type to register fields with diag manager")
2840 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2841 do n = 1, var%num_bcs
2842 do m = 1, var%bc(n)%num_fields
2844 & var%bc(n)%field(m)%name, axes(1:2), time,&
2845 & var%bc(n)%field(m)%long_name, var%bc(n)%field(m)%units)
2848 else if(
associated(var%bc_r4))
then
2849 do n = 1, var%num_bcs
2850 do m = 1, var%bc_r4(n)%num_fields
2852 & var%bc_r4(n)%field(m)%name, axes(1:2), time,&
2853 & var%bc_r4(n)%field(m)%long_name, var%bc_r4(n)%field(m)%units)
2857 call mpp_error(fatal,
"CT_set_diags_2d: passed in type has unassociated coupler_field_type"// &
2858 " pointers for both bc and bc_r4")
2869 character(len=*),
intent(in) :: diag_name
2871 integer,
dimension(:),
intent(in) :: axes
2876 if (diag_name ==
' ')
return
2878 if (
size(axes) < 3)
then
2879 call mpp_error(fatal,
'==>Error from coupler_types_mod' //&
2880 &
'(coupler_types_set_diags_3d): axes has less than 3 elements')
2883 if(var%set .and. var%num_bcs .gt. 0)
then
2884 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2885 if(
associated(var%bc) )
then
2886 call mpp_error(fatal,
"CT_set_diags_3d: var%bc and var%bc_r4 are both initialized,"//&
2887 "only one should be associated per type")
2889 call mpp_error(fatal,
"CT_set_diags_3d: var%bc and var%bc_r4 are both uninitialized,"//&
2890 "one should be associated per type to register fields with diag manager")
2896 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2897 do n = 1, var%num_bcs
2898 do m = 1, var%bc(n)%num_fields
2900 & var%bc(n)%field(m)%name, axes(1:3), time,&
2901 & var%bc(n)%field(m)%long_name, var%bc(n)%field(m)%units )
2904 else if(
associated(var%bc_r4))
then
2905 do n = 1, var%num_bcs
2906 do m = 1, var%bc_r4(n)%num_fields
2908 & var%bc_r4(n)%field(m)%name, axes(1:3), time,&
2909 & var%bc_r4(n)%field(m)%long_name, var%bc_r4(n)%field(m)%units )
2913 call mpp_error(fatal,
"CT_set_diags_3d: passed in type has unassociated coupler_field_type"// &
2914 " pointers for both bc and bc_r4")
2923 logical,
allocatable,
optional,
intent(out) :: return_statuses(:,:)
2930 if(var%set .and. var%num_bcs .gt. 0)
then
2931 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2932 if(
associated(var%bc) )
then
2933 call mpp_error(fatal,
"CT_send_data_2d: var%bc and var%bc_r4 are both initialized,"//&
2934 "only one should be associated per type")
2936 call mpp_error(fatal,
"CT_send_data_2d: var%bc and var%bc_r4 are both uninitialized,"//&
2937 "one should be associated per type to send data to diag fields")
2943 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2946 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
2947 allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
2950 do n = 1, var%num_bcs
2951 do m = 1, var%bc(n)%num_fields
2952 if (var%bc(n)%field(m)%id_diag > 0)
then
2953 used =
send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, time)
2954 if(
allocated(return_statuses)) return_statuses(n,m) = used
2959 else if(
associated(var%bc_r4))
then
2962 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
2963 allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
2966 do n = 1, var%num_bcs
2967 do m = 1, var%bc_r4(n)%num_fields
2968 if (var%bc_r4(n)%field(m)%id_diag > 0)
then
2969 used =
send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, time)
2970 if(
allocated(return_statuses)) return_statuses(n,m) = used
2975 call mpp_error(fatal,
"CT_send_data_2d: passed in type has unassociated coupler_field_type"// &
2976 " pointers for both bc and bc_r4")
2984 logical,
allocatable,
optional,
intent(out) :: return_statuses(:,:)
2991 if(var%set .and. var%num_bcs .gt. 0)
then
2992 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2993 if(
associated(var%bc) )
then
2994 call mpp_error(fatal,
"CT_send_data_3d: var%bc and var%bc_r4 are both initialized,"//&
2995 "only one should be associated per type")
2997 call mpp_error(fatal,
"CT_send_data_3d: var%bc and var%bc_r4 are both uninitialized,"//&
2998 "one should be associated per type to send data to diag fields")
3004 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3007 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
3008 allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
3011 do n = 1, var%num_bcs
3012 do m = 1, var%bc(n)%num_fields
3013 if (var%bc(n)%field(m)%id_diag > 0)
then
3014 used =
send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, time)
3015 if(
allocated(return_statuses)) return_statuses(n,m) = used
3019 else if(
associated(var%bc_r4))
then
3022 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
3023 allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
3026 do n = 1, var%num_bcs
3027 do m = 1, var%bc_r4(n)%num_fields
3028 if (var%bc_r4(n)%field(m)%id_diag > 0)
then
3029 used =
send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, time)
3030 if(
allocated(return_statuses)) return_statuses(n,m) = used
3035 call mpp_error(fatal,
"CT_send_data_3d: passed in type has unassociated coupler_field_type"// &
3036 " pointers for both bc and bc_r4")
3045 type(fmsnetcdfdomainfile_t),
dimension(:),
pointer :: bc_rest_files
3046 integer,
intent(out) :: num_rest_files
3047 type(
domain2d),
intent(in) :: mpp_domain
3048 logical,
intent(in) :: to_read
3049 logical,
optional,
intent(in) :: ocean_restart
3050 character(len=*),
optional,
intent(in) :: directory
3052 character(len=FMS_FILE_LEN),
dimension(max(1,var%num_bcs)) :: rest_file_names
3053 character(len=FMS_FILE_LEN) :: file_nm
3057 character(len=20),
allocatable,
dimension(:) :: dim_names
3058 character(len=20) :: io_type
3059 logical,
dimension(max(1,var%num_bcs)) :: file_is_open
3060 character(len=FMS_PATH_LEN) :: dir
3062 if(var%set .and. var%num_bcs .gt. 0)
then
3063 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3064 if(
associated(var%bc) )
then
3065 call mpp_error(fatal,
"CT_register_restarts_2d: var%bc and var%bc_r4 are both initialized,"//&
3066 "only one should be associated per type")
3068 call mpp_error(fatal,
"CT_register_restarts_2d: var%bc and var%bc_r4 are both uninitialized,"//&
3069 "one should be associated per type to register restart fields")
3075 if (
present(ocean_restart)) ocn_rest = ocean_restart
3077 if (
present(directory)) dir = trim(directory)
3081 if (.not.
present(directory)) dir =
"INPUT/"
3083 io_type =
"overwrite"
3084 if (.not.
present(directory)) dir =
"RESTART/"
3089 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3091 do n = 1, var%num_bcs
3092 if (var%bc(n)%num_fields <= 0) cycle
3093 file_nm = trim(var%bc(n)%ice_restart_file)
3094 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3095 do f = 1, num_rest_files
3096 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3098 if (f>num_rest_files)
then
3099 num_rest_files = num_rest_files + 1
3100 rest_file_names(f) = trim(file_nm)
3104 if (num_rest_files == 0)
return
3106 allocate(bc_rest_files(num_rest_files))
3109 do n = 1, num_rest_files
3110 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3111 & is_restart=.true.)
3112 if (file_is_open(n))
then
3118 do n = 1, var%num_bcs
3119 if (var%bc(n)%num_fields <= 0) cycle
3121 file_nm = trim(var%bc(n)%ice_restart_file)
3122 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3123 do f = 1, num_rest_files
3124 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3127 var%bc(n)%fms2_io_rest_type => bc_rest_files(f)
3129 do m = 1, var%bc(n)%num_fields
3130 if (file_is_open(f))
then
3131 if( to_read .and. variable_exists(bc_rest_files(f), var%bc(n)%field(m)%name))
then
3133 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc(n)%field(m)%name)))
3134 call get_variable_dimension_names(bc_rest_files(f), &
3135 & var%bc(n)%field(m)%name, dim_names)
3138 allocate(dim_names(3))
3139 dim_names(1) =
"xaxis_1"
3140 dim_names(2) =
"yaxis_1"
3141 dim_names(3) =
"Time"
3145 & var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, dim_names, &
3146 & is_optional=var%bc(n)%field(m)%may_init )
3148 deallocate(dim_names)
3152 else if(
associated(var%bc_r4))
then
3154 do n = 1, var%num_bcs
3155 if (var%bc_r4(n)%num_fields <= 0) cycle
3156 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3157 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3158 do f = 1, num_rest_files
3159 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3161 if (f>num_rest_files)
then
3162 num_rest_files = num_rest_files + 1
3163 rest_file_names(f) = trim(file_nm)
3167 if (num_rest_files == 0)
return
3169 allocate(bc_rest_files(num_rest_files))
3172 do n = 1, num_rest_files
3173 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3174 & is_restart=.true.)
3175 if (file_is_open(n))
then
3181 do n = 1, var%num_bcs
3182 if (var%bc_r4(n)%num_fields <= 0) cycle
3184 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3185 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3186 do f = 1, num_rest_files
3187 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3190 var%bc_r4(n)%fms2_io_rest_type => bc_rest_files(f)
3192 do m = 1, var%bc_r4(n)%num_fields
3193 if (file_is_open(f))
then
3194 if( to_read .and. variable_exists(bc_rest_files(f), var%bc_r4(n)%field(m)%name))
then
3196 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc_r4(n)%field(m)%name)))
3197 call get_variable_dimension_names(bc_rest_files(f), &
3198 & var%bc_r4(n)%field(m)%name, dim_names)
3201 allocate(dim_names(3))
3202 dim_names(1) =
"xaxis_1"
3203 dim_names(2) =
"yaxis_1"
3204 dim_names(3) =
"Time"
3208 & var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, dim_names, &
3209 & is_optional=var%bc_r4(n)%field(m)%may_init )
3211 deallocate(dim_names)
3216 call mpp_error(fatal,
"CT_register_restarts_2d: passed in type has unassociated coupler_field_type"// &
3217 " pointers for both bc and bc_r4")
3224 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3226 character(len=20),
dimension(:),
allocatable :: file_dim_names
3230 logical :: is_domain_decomposed
3231 character(len=1) :: buffer
3233 ndims = get_num_dimensions(fileobj)
3234 allocate(file_dim_names(ndims))
3236 call get_dimension_names(fileobj, file_dim_names)
3239 is_domain_decomposed = .false.
3242 if (variable_exists(fileobj, file_dim_names(i)))
then
3245 if (variable_att_exists(fileobj, file_dim_names(i),
"axis"))
then
3246 call get_variable_attribute(fileobj, file_dim_names(i),
"axis", buffer)
3249 if (lowercase(buffer) .eq.
"x" .or. lowercase(buffer) .eq.
"y" )
then
3250 is_domain_decomposed = .true.
3254 else if (variable_att_exists(fileobj, file_dim_names(i),
"cartesian_axis"))
then
3255 call get_variable_attribute(fileobj, file_dim_names(i),
"cartesian_axis", buffer)
3258 if (lowercase(buffer) .eq.
"x" .or. lowercase(buffer) .eq.
"y" )
then
3259 is_domain_decomposed = .true.
3266 if (.not. is_domain_decomposed)
then
3267 call get_dimension_size(fileobj, file_dim_names(i), dim_size)
3277 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3278 integer,
intent(in),
optional :: nz
3280 character(len=20) :: dim_names(4)
3282 dim_names(1) =
"xaxis_1"
3283 dim_names(2) =
"yaxis_1"
3289 if (.not.
present(nz))
then
3290 dim_names(3) =
"Time"
3293 dim_names(3) =
"zaxis_1"
3294 dim_names(4) =
"Time"
3301 call register_field(fileobj, dim_names(1),
"double", (/dim_names(1)/))
3302 call register_variable_attribute(fileobj, dim_names(1),
"axis",
"X", str_len=1)
3304 call register_field(fileobj, dim_names(2),
"double", (/dim_names(2)/))
3305 call register_variable_attribute(fileobj, dim_names(2),
"axis",
"Y", str_len=1)
3310 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3311 logical,
intent(in) :: to_read
3312 integer,
intent(in),
optional :: nz
3327 type(fmsnetcdfdomainfile_t),
dimension(:),
pointer :: bc_rest_files
3328 integer,
intent(out) :: num_rest_files
3329 type(
domain2d),
intent(in) :: mpp_domain
3330 logical,
intent(in) :: to_read
3331 logical,
optional,
intent(in) :: ocean_restart
3332 character(len=*),
optional,
intent(in) :: directory
3334 character(len=FMS_FILE_LEN),
dimension(max(1,var%num_bcs)) :: rest_file_names
3335 character(len=FMS_FILE_LEN) :: file_nm
3339 character(len=20),
allocatable,
dimension(:) :: dim_names
3340 character(len=20) :: io_type
3341 logical,
dimension(max(1,var%num_bcs)) :: file_is_open
3342 character(len=FMS_PATH_LEN) :: dir
3345 if(var%set .and. var%num_bcs .gt. 0)
then
3346 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3347 if(
associated(var%bc) )
then
3348 call mpp_error(fatal,
"CT_register_restarts_3d: var%bc and var%bc_r4 are both initialized,"//&
3349 "only one should be associated per type")
3351 call mpp_error(fatal,
"CT_register_restarts_3d: var%bc and var%bc_r4 are both uninitialized,"//&
3352 "one should be associated per type to register restart fields")
3358 if (
present(ocean_restart)) ocn_rest = ocean_restart
3360 if (
present(directory)) dir = trim(directory)
3364 if (.not.
present(directory)) dir =
"INPUT/"
3366 io_type =
"overwrite"
3367 if (.not.
present(directory)) dir =
"RESTART/"
3370 nz = var%ke - var%ks + 1
3373 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3375 do n = 1, var%num_bcs
3376 if (var%bc(n)%num_fields <= 0) cycle
3377 file_nm = trim(var%bc(n)%ice_restart_file)
3378 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3379 do f = 1, num_rest_files
3380 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3382 if (f>num_rest_files)
then
3383 num_rest_files = num_rest_files + 1
3384 rest_file_names(f) = trim(file_nm)
3388 if (num_rest_files == 0)
return
3390 allocate(bc_rest_files(num_rest_files))
3393 do n = 1, num_rest_files
3394 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3395 & is_restart=.true.)
3396 if (file_is_open(n))
then
3407 do n = 1, var%num_bcs
3408 if (var%bc(n)%num_fields <= 0) cycle
3410 file_nm = trim(var%bc(n)%ice_restart_file)
3411 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3412 do f = 1, num_rest_files
3413 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3416 var%bc(n)%fms2_io_rest_type => bc_rest_files(f)
3418 do m = 1, var%bc(n)%num_fields
3419 if (file_is_open(f))
then
3420 if( to_read .and. variable_exists(bc_rest_files(f), var%bc(n)%field(m)%name))
then
3422 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc(n)%field(m)%name)))
3423 call get_variable_dimension_names(bc_rest_files(f), &
3424 & var%bc(n)%field(m)%name, dim_names)
3427 allocate(dim_names(4))
3428 dim_names(1) =
"xaxis_1"
3429 dim_names(2) =
"yaxis_1"
3430 dim_names(3) =
"zaxis_1"
3431 dim_names(4) =
"Time"
3435 & var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, dim_names, &
3436 & is_optional=var%bc(n)%field(m)%may_init )
3437 deallocate(dim_names)
3441 else if(
associated(var%bc_r4))
then
3443 do n = 1, var%num_bcs
3444 if (var%bc_r4(n)%num_fields <= 0) cycle
3445 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3446 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3447 do f = 1, num_rest_files
3448 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3450 if (f>num_rest_files)
then
3451 num_rest_files = num_rest_files + 1
3452 rest_file_names(f) = trim(file_nm)
3456 if (num_rest_files == 0)
return
3458 allocate(bc_rest_files(num_rest_files))
3461 do n = 1, num_rest_files
3462 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3463 & is_restart=.true.)
3464 if (file_is_open(n))
then
3475 do n = 1, var%num_bcs
3476 if (var%bc_r4(n)%num_fields <= 0) cycle
3478 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3479 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3480 do f = 1, num_rest_files
3481 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3484 var%bc_r4(n)%fms2_io_rest_type => bc_rest_files(f)
3486 do m = 1, var%bc_r4(n)%num_fields
3487 if (file_is_open(f))
then
3488 if( to_read .and. variable_exists(bc_rest_files(f), var%bc_r4(n)%field(m)%name))
then
3490 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc_r4(n)%field(m)%name)))
3491 call get_variable_dimension_names(bc_rest_files(f), &
3492 & var%bc_r4(n)%field(m)%name, dim_names)
3495 allocate(dim_names(4))
3496 dim_names(1) =
"xaxis_1"
3497 dim_names(2) =
"yaxis_1"
3498 dim_names(3) =
"zaxis_1"
3499 dim_names(4) =
"Time"
3503 & var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, dim_names, &
3504 & is_optional=var%bc_r4(n)%field(m)%may_init )
3505 deallocate(dim_names)
3510 call mpp_error(fatal,
"CT_register_restarts_2d: passed in type has unassociated coupler_field_type"// &
3511 " pointers for both bc and bc_r4")
3517 character(len=*),
optional,
intent(in) :: directory
3519 logical,
optional,
intent(in) :: all_or_nothing
3522 logical,
optional,
intent(in) :: all_required
3525 logical,
optional,
intent(in) :: test_by_field
3527 logical,
intent(in) :: use_fms2_io
3529 integer :: n, m, num_fld
3530 character(len=80) :: unset_varname
3531 logical :: any_set, all_set, all_var_set, any_var_set, var_set
3533 if(var%set .and. var%num_bcs .gt. 0)
then
3534 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3535 if(
associated(var%bc) )
then
3536 call mpp_error(fatal,
"CT_restore_state_2d: var%bc and var%bc_r4 are both initialized," // &
3537 "only one should be associated per type")
3539 call mpp_error(fatal,
"CT_restore_state_2d: var%bc and var%bc_r4 are both uninitialized," // &
3540 "one should be associated per type to restore state from restart")
3550 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3551 do n = 1, var%num_bcs
3552 any_var_set = .false.
3553 all_var_set = .true.
3554 do m = 1, var%bc(n)%num_fields
3556 if (check_if_open(var%bc(n)%fms2_io_rest_type))
then
3557 var_set = variable_exists(var%bc(n)%fms2_io_rest_type, var%bc(n)%field(m)%name)
3560 if (.not.var_set) unset_varname = trim(var%bc(n)%field(m)%name)
3561 if (var_set) any_set = .true.
3562 if (all_set) all_set = var_set
3563 if (var_set) any_var_set = .true.
3564 if (all_var_set) all_var_set = var_set
3567 num_fld = num_fld + var%bc(n)%num_fields
3568 if ((var%bc(n)%num_fields > 0) .and.
present(test_by_field))
then
3569 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3570 &
"CT_restore_state_2d: test_by_field is true, and "//&
3571 & trim(unset_varname)//
" was not read but some other fields in "//&
3572 & trim(trim(var%bc(n)%name))//
" were.")
3575 else if(
associated(var%bc_r4))
then
3576 do n = 1, var%num_bcs
3577 any_var_set = .false.
3578 all_var_set = .true.
3579 do m = 1, var%bc_r4(n)%num_fields
3581 if (check_if_open(var%bc_r4(n)%fms2_io_rest_type))
then
3582 var_set = variable_exists(var%bc_r4(n)%fms2_io_rest_type, var%bc_r4(n)%field(m)%name)
3585 if (.not.var_set) unset_varname = trim(var%bc_r4(n)%field(m)%name)
3586 if (var_set) any_set = .true.
3587 if (all_set) all_set = var_set
3588 if (var_set) any_var_set = .true.
3589 if (all_var_set) all_var_set = var_set
3592 num_fld = num_fld + var%bc_r4(n)%num_fields
3593 if ((var%bc_r4(n)%num_fields > 0) .and.
present(test_by_field))
then
3594 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3595 &
"CT_restore_state_2d: test_by_field is true, and "//&
3596 & trim(unset_varname)//
" was not read but some other fields in "//&
3597 & trim(trim(var%bc_r4(n)%name))//
" were.")
3601 call mpp_error(fatal,
"CT_restore_state_2d: passed in type has unassociated coupler_field_type"// &
3602 " pointers for both bc and bc_r4")
3605 if ((num_fld > 0) .and.
present(all_or_nothing))
then
3606 if (all_or_nothing .and. (all_set .neqv. any_set))
call mpp_error(fatal,&
3607 &
"CT_restore_state_2d: all_or_nothing is true, and "//&
3608 & trim(unset_varname)//
" was not read but some other fields were.")
3611 if (
present(all_required))
then
3612 if (all_required .and. .not.all_set)
then
3613 call mpp_error(fatal,
"CT_restore_state_2d: all_required is true, but "//&
3614 & trim(unset_varname)//
" was not read from its restart file.")
3625 character(len=*),
optional,
intent(in) :: directory
3627 logical,
intent(in) :: use_fms2_io
3628 logical,
optional,
intent(in) :: all_or_nothing
3631 logical,
optional,
intent(in) :: all_required
3634 logical,
optional,
intent(in) :: test_by_field
3637 integer :: n, m, num_fld
3638 character(len=80) :: unset_varname
3639 logical :: any_set, all_set, all_var_set, any_var_set, var_set
3641 if(var%set .and. var%num_bcs .gt. 0)
then
3642 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3643 if(
associated(var%bc) )
then
3644 call mpp_error(fatal,
"CT_restore_state_3d: var%bc and var%bc_r4 are both initialized," // &
3645 "only one should be associated per type")
3647 call mpp_error(fatal,
"CT_restore_state_3d: var%bc and var%bc_r4 are both uninitialized," // &
3648 "one should be associated per type to restore state from restart")
3658 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3659 do n = 1, var%num_bcs
3660 any_var_set = .false.
3661 all_var_set = .true.
3662 do m = 1, var%bc(n)%num_fields
3664 if (check_if_open(var%bc(n)%fms2_io_rest_type))
then
3665 var_set = variable_exists(var%bc(n)%fms2_io_rest_type, var%bc(n)%field(m)%name)
3668 if (.not.var_set) unset_varname = trim(var%bc(n)%field(m)%name)
3670 if (var_set) any_set = .true.
3671 if (all_set) all_set = var_set
3672 if (var_set) any_var_set = .true.
3673 if (all_var_set) all_var_set = var_set
3676 num_fld = num_fld + var%bc(n)%num_fields
3677 if ((var%bc(n)%num_fields > 0) .and.
present(test_by_field))
then
3678 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3679 &
"CT_restore_state_3d: test_by_field is true, and "//&
3680 & trim(unset_varname)//
" was not read but some other fields in "//&
3681 & trim(trim(var%bc(n)%name))//
" were.")
3684 else if(
associated(var%bc_r4))
then
3685 do n = 1, var%num_bcs
3686 any_var_set = .false.
3687 all_var_set = .true.
3688 do m = 1, var%bc_r4(n)%num_fields
3690 if (check_if_open(var%bc_r4(n)%fms2_io_rest_type))
then
3691 var_set = variable_exists(var%bc_r4(n)%fms2_io_rest_type, var%bc_r4(n)%field(m)%name)
3694 if (.not.var_set) unset_varname = trim(var%bc_r4(n)%field(m)%name)
3696 if (var_set) any_set = .true.
3697 if (all_set) all_set = var_set
3698 if (var_set) any_var_set = .true.
3699 if (all_var_set) all_var_set = var_set
3702 num_fld = num_fld + var%bc_r4(n)%num_fields
3703 if ((var%bc_r4(n)%num_fields > 0) .and.
present(test_by_field))
then
3704 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3705 &
"CT_restore_state_3d: test_by_field is true, and "//&
3706 & trim(unset_varname)//
" was not read but some other fields in "//&
3707 & trim(trim(var%bc(n)%name))//
" were.")
3711 call mpp_error(fatal,
"CT_restore_state_3d: passed in type has unassociated coupler_field_type"// &
3712 " pointers for both bc and bc_r4")
3716 if ((num_fld > 0) .and.
present(all_or_nothing))
then
3717 if (all_or_nothing .and. (all_set .neqv. any_set))
call mpp_error(fatal,&
3718 &
"CT_restore_state_3d: all_or_nothing is true, and "//&
3719 & trim(unset_varname)//
" was not read but some other fields were.")
3722 if (
present(all_required))
then
3723 if (all_required .and. .not.all_set)
then
3724 call mpp_error(fatal,
"CT_restore_state_3d: all_required is true, but "//&
3725 & trim(unset_varname)//
" was not read from its restart file.")
3733 character(len=3),
intent(in) :: gridname
3738 if(var%set .and. var%num_bcs .gt. 0)
then
3739 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3740 if(
associated(var%bc) )
then
3741 call mpp_error(fatal,
"CT_data_override_2d: var%bc and var%bc_r4 are both initialized," // &
3742 "only one should be associated per type")
3744 call mpp_error(fatal,
"CT_data_override_2d: var%bc and var%bc_r4 are both uninitialized," // &
3745 "one should be associated per type to perform data override")
3750 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3751 do n = 1, var%num_bcs
3752 do m = 1, var%bc(n)%num_fields
3753 call data_override(gridname, var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, time)
3756 else if(
associated(var%bc_r4))
then
3757 do n = 1, var%num_bcs
3758 do m = 1, var%bc_r4(n)%num_fields
3759 call data_override(gridname, var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, time)
3763 call mpp_error(fatal,
"CT_data_override_2d: passed in type has unassociated coupler_field_type"// &
3764 " pointers for both bc and bc_r4")
3770 character(len=3),
intent(in) :: gridname
3774 real(r8_kind),
allocatable :: r8_field_values(:,:,:)
3778 if(var%set .and. var%num_bcs .gt. 0)
then
3779 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3780 if(
associated(var%bc) )
then
3781 call mpp_error(fatal,
"CT_data_override_3d: var%bc and var%bc_r4 are both initialized," // &
3782 "only one should be associated per type")
3784 call mpp_error(fatal,
"CT_data_override_3d: var%bc and var%bc_r4 are both uninitialized," // &
3785 "one should be associated per type to perform data override")
3790 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3791 do n = 1, var%num_bcs
3792 do m = 1, var%bc(n)%num_fields
3793 call data_override(gridname, var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, time)
3796 else if(
associated(var%bc_r4))
then
3797 do n = 1, var%num_bcs
3798 do m = 1, var%bc_r4(n)%num_fields
3799 call data_override(gridname, var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, time)
3803 call mpp_error(fatal,
"CT_data_override_3d: passed in type has unassociated coupler_field_type"// &
3804 " pointers for both bc and bc_r4")
3813 integer,
intent(in) :: outunit
3814 character(len=*),
optional,
intent(in) :: name_lead
3816 character(len=120) :: var_name
3818 integer(i8_kind) :: chks
3820 if(var%set .and. var%num_bcs .gt. 0)
then
3821 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3822 if(
associated(var%bc) )
then
3823 call mpp_error(fatal,
"CT_write_chksums_2d: var%bc and var%bc_r4 are both initialized," // &
3824 "only one should be associated per type")
3826 call mpp_error(fatal,
"CT_write_chksums_2d: var%bc and var%bc_r4 are both uninitialized," // &
3827 "one should be associated per type to write checksums for fields")
3832 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3833 do n = 1, var%num_bcs
3834 do m = 1, var%bc(n)%num_fields
3835 if (
present(name_lead))
then
3836 var_name = trim(name_lead)//trim(var%bc(n)%field(m)%name)
3838 var_name = trim(var%bc(n)%field(m)%name)
3840 chks =
mpp_chksum(var%bc(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec))
3841 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3844 else if(
associated(var%bc_r4))
then
3845 do n = 1, var%num_bcs
3846 do m = 1, var%bc_r4(n)%num_fields
3847 if (
present(name_lead))
then
3848 var_name = trim(name_lead)//trim(var%bc_r4(n)%field(m)%name)
3850 var_name = trim(var%bc_r4(n)%field(m)%name)
3852 chks =
mpp_chksum(var%bc_r4(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec))
3853 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3857 call mpp_error(fatal,
"CT_write_chksums_2d: passed in type has unassociated coupler_field_type"// &
3858 " pointers for both bc and bc_r4")
3865 integer,
intent(in) :: outunit
3866 character(len=*),
optional,
intent(in) :: name_lead
3868 character(len=120) :: var_name
3870 integer(i8_kind) :: chks
3872 if(var%set .and. var%num_bcs .gt. 0)
then
3873 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3874 if(
associated(var%bc) )
then
3875 call mpp_error(fatal,
"CT_write_chksums_3d: var%bc and var%bc_r4 are both initialized," // &
3876 "only one should be associated per type")
3878 call mpp_error(fatal,
"CT_write_chksums_3d: var%bc and var%bc_r4 are both uninitialized," // &
3879 "one should be associated per type to write checksums for fields")
3884 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3885 do n = 1, var%num_bcs
3886 do m = 1, var%bc(n)%num_fields
3887 if (
present(name_lead))
then
3888 var_name = trim(name_lead)//trim(var%bc(n)%field(m)%name)
3890 var_name = trim(var%bc(n)%field(m)%name)
3892 chks =
mpp_chksum(var%bc(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec,:))
3893 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3896 else if(
associated(var%bc_r4))
then
3897 do n = 1, var%num_bcs
3898 do m = 1, var%bc_r4(n)%num_fields
3899 if (
present(name_lead))
then
3900 var_name = trim(name_lead)//trim(var%bc_r4(n)%field(m)%name)
3902 var_name = trim(var%bc_r4(n)%field(m)%name)
3904 chks =
mpp_chksum(var%bc_r4(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec,:))
3905 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3909 call mpp_error(fatal,
"CT_write_chksums_2d: passed in type has unassociated coupler_field_type"// &
3910 " pointers for both bc and bc_r4")
3945 if (var%num_bcs > 0)
then
3946 if(
associated(var%bc))
then
3947 do n = 1, var%num_bcs
3948 do m = 1, var%bc(n)%num_fields
3949 deallocate ( var%bc(n)%field(m)%values )
3951 deallocate ( var%bc(n)%field )
3953 deallocate ( var%bc )
3954 else if(
associated(var%bc_r4))
then
3955 do n = 1, var%num_bcs
3956 do m = 1, var%bc_r4(n)%num_fields
3957 deallocate ( var%bc_r4(n)%field(m)%values )
3959 deallocate ( var%bc_r4(n)%field )
3961 deallocate ( var%bc_r4 )
3963 call mpp_error(fatal,
"CT_destructor_1d: passed in type has unassociated coupler_field_type"// &
3964 " pointers for both bc and bc_r4")
3978 if (var%num_bcs > 0)
then
3979 if(
associated(var%bc))
then
3980 do n = 1, var%num_bcs
3981 do m = 1, var%bc(n)%num_fields
3982 deallocate ( var%bc(n)%field(m)%values )
3984 deallocate ( var%bc(n)%field )
3986 deallocate ( var%bc )
3987 else if(
associated(var%bc_r4))
then
3988 do n = 1, var%num_bcs
3989 do m = 1, var%bc_r4(n)%num_fields
3990 deallocate ( var%bc_r4(n)%field(m)%values )
3992 deallocate ( var%bc_r4(n)%field )
3994 deallocate ( var%bc_r4 )
3996 call mpp_error(fatal,
"CT_destructor_2d: passed in type has unassociated coupler_field_type"// &
3997 " pointers for both bc and bc_r4")
4011 if (var%num_bcs > 0)
then
4012 if(
associated(var%bc))
then
4013 do n = 1, var%num_bcs
4014 do m = 1, var%bc(n)%num_fields
4015 deallocate ( var%bc(n)%field(m)%values )
4017 deallocate ( var%bc(n)%field )
4019 deallocate ( var%bc )
4020 else if(
associated(var%bc_r4))
then
4021 do n = 1, var%num_bcs
4022 do m = 1, var%bc_r4(n)%num_fields
4023 deallocate ( var%bc_r4(n)%field(m)%values )
4025 deallocate ( var%bc_r4(n)%field )
4027 deallocate ( var%bc_r4 )
4029 call mpp_error(fatal,
"CT_destructor_3d: passed in type has unassociated coupler_field_type"// &
4030 " pointers for both bc and bc_r4")
4039 #include "coupler_types_r4.fh"
4040 #include "coupler_types_r8.fh"
4042 end module coupler_types_mod
subroutine ct_redistribute_data_2d(var_in, domain_in, var_out, domain_out, complete)
Redistribute the data in all elements of a coupler_2d_bc_type.
integer, public ind_kw
The index for the piston velocity.
subroutine ct_data_override_2d(gridname, var, Time)
Potentially override the values in a coupler_2d_bc_type.
subroutine register_axis_wrapper_write(fileobj, nz)
integer, public ind_u10
The index of the 10 m wind speed.
subroutine coupler_type_copy_2d_2d(var_in, var_out, is, ie, js, je, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 2-D to 2-D version for generic coupler_type_copy.
subroutine ct_spawn_3d_2d(var_in, var, idim, jdim, suffix, as_needed)
Generate one coupler type using another as a template. 3-D to 2-D version for generic CT_spawn.
integer, public ind_runoff
The index for a runoff flux.
integer, public ind_csurf
The index of the ocean surface concentration.
subroutine, public coupler_types_init
Initialize the coupler types.
subroutine ct_spawn_3d_3d(var_in, var, idim, jdim, kdim, suffix, as_needed)
Generate one coupler type using another as a template. 3-D to 3-D version for generic CT_spawn.
logical function ct_initialized_2d(var)
Indicate whether a coupler_2d_bc_type has been initialized.
subroutine ct_register_restarts_2d(var, bc_rest_files, num_rest_files, mpp_domain, to_read, ocean_restart, directory)
subroutine ct_send_data_3d(var, Time, return_statuses)
Write out all diagnostics of elements of a coupler_3d_bc_type.
integer, public ind_sc_no
The index for the Schmidt number for a tracer flux.
integer, public ind_deposition
The index for the atmospheric deposition flux.
subroutine ct_destructor_1d(var)
Deallocate all data associated with a coupler_1d_bc_type.
subroutine ct_destructor_2d(var)
Deallocate all data associated with a coupler_2d_bc_type.
subroutine ct_spawn_2d_2d(var_in, var, idim, jdim, suffix, as_needed)
Generate one coupler type using another as a template. 2-D to 2-D version for generic CT_spawn.
subroutine ct_write_chksums_2d(var, outunit, name_lead)
Write out checksums for the elements of a coupler_2d_bc_type.
subroutine ct_increment_data_3d_3d(var_in, var, halo_size, bc_index, field_index, scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
Increment data in all elements of one coupler_3d_bc_type.
subroutine ct_restore_state_2d(var, use_fms2_io, directory, all_or_nothing, all_required, test_by_field)
subroutine ct_set_diags_3d(var, diag_name, axes, time)
Register the diagnostics of a coupler_3d_bc_type.
subroutine register_axis_wrapper(fileobj, to_read, nz)
subroutine, public coupler_type_copy_1d_3d(var_in, var_out, is, ie, js, je, kd, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 1-D to 3-D version for generic coupler_type_copy.
subroutine coupler_type_copy_3d_3d(var_in, var_out, is, ie, js, je, kd, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 3-D to 3-D version for generic coupler_type_copy.
subroutine ct_redistribute_data_3d(var_in, domain_in, var_out, domain_out, complete)
Redistributes the data in all elements of one coupler_2d_bc_type.
subroutine ct_spawn_1d_3d(var_in, var, idim, jdim, kdim, suffix, as_needed)
Generate one coupler type using another as a template. 1-D to 3-D version for generic CT_spawn.
subroutine ct_copy_data_3d(var_in, var, halo_size, bc_index, field_index, exclude_flux_type, only_flux_type, pass_through_ice)
Copy all elements of coupler_3d_bc_type.
integer, public ind_alpha
The index of the solubility array for a tracer.
subroutine ct_set_diags_2d(var, diag_name, axes, time)
logical function ct_initialized_1d(var)
Indicate whether a coupler_1d_bc_type has been initialized.
subroutine ct_copy_data_2d(var_in, var, halo_size, bc_index, field_index, exclude_flux_type, only_flux_type, pass_through_ice)
Copy all elements of coupler_2d_bc_type. Do a direct copy of the data in all elements of one coupler_...
subroutine ct_spawn_2d_3d(var_in, var, idim, jdim, kdim, suffix, as_needed)
Generate one coupler type using another as a template. 2-D to 3-D version for generic CT_spawn.
subroutine ct_write_chksums_3d(var, outunit, name_lead)
Write out checksums for the elements of a coupler_3d_bc_type.
subroutine ct_spawn_1d_2d(var_in, var, idim, jdim, suffix, as_needed)
Generate one coupler type using another as a template. 1-D to 2-D version for generic coupler_type_sp...
subroutine coupler_type_copy_3d_2d(var_in, var_out, is, ie, js, je, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 3-D to 2-D version for generic coupler_type_copy.
integer, public ind_flux
The index for the tracer flux.
subroutine ct_destructor_3d(var)
Deallocate all data associated with a coupler_3d_bc_type.
integer, public ind_pcair
The index of the atmospheric concentration.
subroutine coupler_type_copy_2d_3d(var_in, var_out, is, ie, js, je, kd, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 2-D to 3-D version for generic coupler_type_copy.
integer, public ind_flux0
The index for the piston velocity.
subroutine ct_copy_data_2d_3d(var_in, var, halo_size, bc_index, field_index, exclude_flux_type, only_flux_type, pass_through_ice, ind3_start, ind3_end)
Copy all elements of coupler_2d_bc_type to coupler_3d_bc_type.
integer, public ind_psurf
The index of the surface atmospheric pressure.
subroutine ct_register_restarts_3d(var, bc_rest_files, num_rest_files, mpp_domain, to_read, ocean_restart, directory)
subroutine ct_increment_data_2d_2d(var_in, var, halo_size, bc_index, field_index, scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
Increment data in all elements of one coupler_2d_bc_type.
subroutine ct_data_override_3d(gridname, var, Time)
Potentially override the values in a coupler_3d_bc_type.
subroutine, public coupler_type_copy_1d_2d(var_in, var_out, is, ie, js, je, diag_name, axes, time, suffix)
Copy fields from one coupler type to another. 1-D to 2-D version for generic coupler_type_copy.
subroutine register_axis_wrapper_read(fileobj)
subroutine ct_restore_state_3d(var, use_fms2_io, directory, all_or_nothing, all_required, test_by_field)
Read in fields from restart files into a coupler_3d_bc_type.
integer, public ind_deltap
The index for ocean-air gas partial pressure change.
logical function ct_initialized_3d(var)
Indicate whether a coupler_3d_bc_type has been initialized.
subroutine ct_send_data_2d(var, Time, return_statuses)
Write out all diagnostics of elements of a coupler_2d_bc_type.
This is the interface to spawn one coupler_bc_type into another and then register diagnostics associa...
This is the interface to copy the field data from one coupler_bc_type to another of the same rank,...
This is the interface to override the values of the arrays in a coupler_bc_type.
This is the interface to deallocate any data associated with a coupler_bc_type.
This is the interface to increment the field data from one coupler_bc_type with the data from another...
This function interface indicates whether a coupler_bc_type has been initialized.
This is the interface to redistribute the field data from one coupler_bc_type to another of the same ...
This is the interface to register the fields in a coupler_bc_type to be saved in restart files.
This is the interface to rescale the field data in a coupler_bc_type.
This is the interface to read in the fields in a coupler_bc_type that have been saved in restart file...
This is the interface to write out diagnostics of the arrays in a coupler_bc_type.
This is the interface to set a field in a coupler_bc_type from an array.
This is the interface to set diagnostics for the arrays in a coupler_bc_type.
This is the interface to spawn one coupler_bc_type into another.
This is the interface to write out checksums for the elements of a coupler_bc_type.
Coupler data for 1D boundary conditions.
Coupler data for 1D fields.
Coupler data for 1D values.
Coupler data for 1D fields.
Coupler data for 1D values.
Coupler data for 2D boundary conditions.
Coupler data for 2D fields.
Coupler data for 2D values.
Coupler data for 2D fields.
Coupler data for 2D values.
Coupler data for 3D boundary conditions.
Coupler data for 3D fields.
Coupler data for 3D values.
Coupler data for 3D fields.
Coupler data for 3D values.
Interface for inserting and interpolating data into a file for a model's grid and time....
Register a diagnostic field for a given module.
Send data over to output fields.
Opens a given netcdf or domain file.
Add a dimension to a given file.
Defines a new field within the given file Example usage:
Similar to register_field, but occupies the field with data for restarts Example usage:
subroutine, public write_version_number(version, tag, unit)
Prints to the log file (or a specified unit) the version id string and tag name.
character(:) function, allocatable, public string(v, fmt)
Converts a number or a Boolean value to a string.
Reorganization of distributed global arrays. mpp_redistribute is used to reorganize a distributed ar...
The domain2D type contains all the necessary information to define the global, compute and data domai...
Calculate parallel checksums.
Type to represent amounts of time. Implemented as seconds and days to allow for larger intervals.