25 module coupler_types_mod
28 use fms2_io_mod,
only:
register_axis, unlimited, variable_exists, check_if_open
29 use fms2_io_mod,
only:
register_field, get_num_dimensions, variable_att_exists
30 use fms2_io_mod,
only: get_variable_attribute, get_dimension_size, get_dimension_names
31 use fms2_io_mod,
only: register_variable_attribute, get_variable_dimension_names
32 use fms2_io_mod,
only: get_variable_num_dimensions
38 use fms_string_utils_mod,
only:
string
39 use platform_mod,
only: r4_kind, r8_kind, i8_kind, fms_file_len, fms_path_len
46 #include<file_version.h>
60 character(len=*),
parameter :: mod_name =
'coupler_types_mod'
76 character(len=48) :: name =
' '
77 logical :: mean = .true.
78 logical :: override = .false.
79 integer :: id_diag = 0
80 character(len=128) :: long_name =
' '
81 character(len=128) :: units =
' '
82 integer :: id_rest = 0
83 logical :: may_init = .true.
86 real(r8_kind),
pointer,
contiguous,
dimension(:,:,:) :: values => null()
94 character(len=48) :: name =
' '
95 integer :: num_fields = 0
97 character(len=128) :: flux_type =
' '
98 character(len=128) :: implementation =
' '
99 logical,
pointer,
dimension(:) :: flag => null()
100 integer :: atm_tr_index = 0
101 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
102 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
103 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
105 logical :: use_atm_pressure
106 logical :: use_10m_wind_speed
107 logical :: pass_through_ice
108 real(r8_kind),
pointer,
dimension(:) :: param => null()
109 real(r8_kind) :: mol_wt = 0.0_r8_kind
115 character(len=48) :: name =
' '
116 logical :: mean = .true.
117 logical :: override = .false.
118 integer :: id_diag = 0
119 character(len=128) :: long_name =
' '
120 character(len=128) :: units =
' '
121 integer :: id_rest = 0
122 logical :: may_init = .true.
125 real(r4_kind),
pointer,
contiguous,
dimension(:,:,:) :: values => null()
133 character(len=48) :: name =
' '
134 integer :: num_fields = 0
136 character(len=128) :: flux_type =
' '
137 character(len=128) :: implementation =
' '
138 logical,
pointer,
dimension(:) :: flag => null()
139 integer :: atm_tr_index = 0
140 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
141 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
142 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
144 logical :: use_atm_pressure
145 logical :: use_10m_wind_speed
146 logical :: pass_through_ice
150 real(r8_kind),
pointer,
dimension(:) :: param => null()
151 real(r8_kind) :: mol_wt = 0.0_r8_kind
157 integer :: num_bcs = 0
161 logical :: set = .false.
162 integer :: isd, isc, iec, ied
163 integer :: jsd, jsc, jec, jed
171 character(len=48) :: name =
' '
172 real(r8_kind),
pointer,
contiguous,
dimension(:,:) :: values => null()
175 logical :: mean = .true.
176 logical :: override = .false.
177 integer :: id_diag = 0
178 character(len=128) :: long_name =
' '
179 character(len=128) :: units =
' '
180 integer :: id_rest = 0
181 logical :: may_init = .true.
189 character(len=48) :: name =
' '
190 integer :: num_fields = 0
192 character(len=128) :: flux_type =
' '
193 character(len=128) :: implementation =
' '
194 real(r8_kind),
pointer,
dimension(:) :: param => null()
195 logical,
pointer,
dimension(:) :: flag => null()
196 integer :: atm_tr_index = 0
197 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
198 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
199 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
201 logical :: use_atm_pressure
202 logical :: use_10m_wind_speed
203 logical :: pass_through_ice
204 real(r8_kind) :: mol_wt = 0.0_r8_kind
210 character(len=44) :: name =
' '
211 real(r4_kind),
pointer,
contiguous,
dimension(:,:) :: values => null()
214 logical :: mean = .true.
215 logical :: override = .false.
216 integer :: id_diag = 0
217 character(len=124) :: long_name =
' '
218 character(len=124) :: units =
' '
219 integer :: id_rest = 0
220 logical :: may_init = .true.
228 character(len=44) :: name =
' '
229 integer :: num_fields = 0
231 character(len=124) :: flux_type =
' '
232 character(len=124) :: implementation =
' '
236 real(r8_kind),
pointer,
dimension(:) :: param => null()
237 logical,
pointer,
dimension(:) :: flag => null()
238 integer :: atm_tr_index = 0
239 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
240 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
241 type(fmsnetcdfdomainfile_t),
pointer :: fms2_io_rest_type => null()
243 logical :: use_atm_pressure
244 logical :: use_10m_wind_speed
245 logical :: pass_through_ice
246 real(r8_kind) :: mol_wt = 0.0_r8_kind
252 integer :: num_bcs = 0
257 logical :: set = .false.
258 integer :: isd, isc, iec, ied
259 integer :: jsd, jsc, jec, jed
265 character(len=48) :: name =
' '
266 real(r8_kind),
pointer,
dimension(:) :: values => null()
267 logical :: mean = .true.
268 logical :: override = .false.
269 integer :: id_diag = 0
270 character(len=128) :: long_name =
' '
271 character(len=128) :: units =
' '
272 logical :: may_init = .true.
280 character(len=48) :: name =
' '
281 integer :: num_fields = 0
283 character(len=128) :: flux_type =
' '
284 character(len=128) :: implementation =
' '
288 real(r8_kind),
pointer,
dimension(:) :: param => null()
289 logical,
pointer,
dimension(:) :: flag => null()
290 integer :: atm_tr_index = 0
291 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
292 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
293 logical :: use_atm_pressure
294 logical :: use_10m_wind_speed
295 logical :: pass_through_ice
299 real(r8_kind) :: mol_wt = 0.0_r8_kind
306 character(len=48) :: name =
' '
307 real(r4_kind),
pointer,
dimension(:) :: values => null()
308 logical :: mean = .true.
309 logical :: override = .false.
310 integer :: id_diag = 0
311 character(len=128) :: long_name =
' '
312 character(len=128) :: units =
' '
313 logical :: may_init = .true.
321 character(len=48) :: name =
' '
322 integer :: num_fields = 0
324 character(len=128) :: flux_type =
' '
325 character(len=128) :: implementation =
' '
329 real(r8_kind),
pointer,
dimension(:) :: param => null()
330 logical,
pointer,
dimension(:) :: flag => null()
331 integer :: atm_tr_index = 0
332 character(len=FMS_FILE_LEN) :: ice_restart_file =
' '
333 character(len=FMS_FILE_LEN) :: ocean_restart_file =
' '
334 logical :: use_atm_pressure
335 logical :: use_10m_wind_speed
336 logical :: pass_through_ice
338 real(r8_kind) :: mol_wt = 0.0_r8_kind
345 integer :: num_bcs = 0
350 logical :: set = .false.
408 module procedure ct_rescale_data_2d_r4, ct_rescale_data_3d_r4
409 module procedure ct_rescale_data_2d_r8, ct_rescale_data_3d_r8
418 module procedure ct_increment_data_2d_3d_r4, ct_increment_data_2d_3d_r8
424 module procedure ct_extract_data_2d_r4, ct_extract_data_2d_r8
425 module procedure ct_extract_data_3d_r4, ct_extract_data_3d_r8
426 module procedure ct_extract_data_3d_2d_r4, ct_extract_data_3d_2d_r8
432 module procedure ct_set_data_2d_r4, ct_set_data_3d_r4, ct_set_data_2d_3d_r4
433 module procedure ct_set_data_2d_r8, ct_set_data_3d_r8, ct_set_data_2d_3d_r8
494 logical,
save :: module_is_initialized = .false.
497 if (module_is_initialized)
then
504 module_is_initialized = .true.
514 & diag_name, axes, time, suffix)
517 integer,
intent(in) :: is
518 integer,
intent(in) :: ie
519 integer,
intent(in) :: js
520 integer,
intent(in) :: je
521 character(len=*),
intent(in) :: diag_name
523 integer,
dimension(:),
intent(in) :: axes
525 character(len=*),
intent(in),
optional :: suffix
527 character(len=*),
parameter :: error_header =&
528 &
'==>Error from coupler_types_mod (coupler_type_copy_1d_2d):'
530 if (var_out%num_bcs > 0)
then
533 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
536 if (var_in%num_bcs >= 0)&
537 &
call ct_spawn_1d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
539 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
548 & diag_name, axes, time, suffix)
551 integer,
intent(in) :: is
552 integer,
intent(in) :: ie
553 integer,
intent(in) :: js
554 integer,
intent(in) :: je
555 integer,
intent(in) :: kd
556 character(len=*),
intent(in) :: diag_name
558 integer,
dimension(:),
intent(in) :: axes
560 character(len=*),
intent(in),
optional :: suffix
562 character(len=*),
parameter :: error_header =&
563 &
'==>Error from coupler_types_mod (coupler_type_copy_1d_3d):'
565 if (var_out%num_bcs > 0)
then
568 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
571 if (var_in%num_bcs >= 0)&
572 &
call ct_spawn_1d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
574 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
582 & diag_name, axes, time, suffix)
585 integer,
intent(in) :: is
586 integer,
intent(in) :: ie
587 integer,
intent(in) :: js
588 integer,
intent(in) :: je
589 character(len=*),
intent(in) :: diag_name
591 integer,
dimension(:),
intent(in) :: axes
593 character(len=*),
intent(in),
optional :: suffix
595 character(len=*),
parameter :: error_header =&
596 &
'==>Error from coupler_types_mod (coupler_type_copy_2d_2d):'
598 if (var_out%num_bcs > 0)
then
601 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
604 if (var_in%num_bcs >= 0)&
605 &
call ct_spawn_2d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
607 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
615 & diag_name, axes, time, suffix)
618 integer,
intent(in) :: is
619 integer,
intent(in) :: ie
620 integer,
intent(in) :: js
621 integer,
intent(in) :: je
622 integer,
intent(in) :: kd
623 character(len=*),
intent(in) :: diag_name
625 integer,
dimension(:),
intent(in) :: axes
627 character(len=*),
intent(in),
optional :: suffix
629 character(len=*),
parameter :: error_header =&
630 &
'==>Error from coupler_types_mod (coupler_type_copy_2d_3d):'
632 if (var_out%num_bcs > 0)
then
635 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
638 if (var_in%num_bcs >= 0)&
639 &
call ct_spawn_2d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
641 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
649 & diag_name, axes, time, suffix)
652 integer,
intent(in) :: is
653 integer,
intent(in) :: ie
654 integer,
intent(in) :: js
655 integer,
intent(in) :: je
656 character(len=*),
intent(in) :: diag_name
658 integer,
dimension(:),
intent(in) :: axes
660 character(len=*),
intent(in),
optional :: suffix
662 character(len=*),
parameter :: error_header =&
663 &
'==>Error from coupler_types_mod (coupler_type_copy_3d_2d):'
665 if (var_out%num_bcs > 0)
then
668 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
671 if (var_in%num_bcs >= 0)&
672 &
call ct_spawn_3d_2d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), suffix)
674 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
682 & diag_name, axes, time, suffix)
685 integer,
intent(in) :: is
686 integer,
intent(in) :: ie
687 integer,
intent(in) :: js
688 integer,
intent(in) :: je
689 integer,
intent(in) :: kd
690 character(len=*),
intent(in) :: diag_name
692 integer,
dimension(:),
intent(in) :: axes
694 character(len=*),
intent(in),
optional :: suffix
696 character(len=*),
parameter :: error_header =&
697 &
'==>Error from coupler_types_mod (coupler_type_copy_3d_3d):'
699 if (var_out%num_bcs > 0)
then
702 call mpp_error(fatal, trim(error_header) //
' Number of output fields exceeds zero')
705 if (var_in%num_bcs >= 0)&
706 &
call ct_spawn_3d_3d(var_in, var_out, (/ is, is, ie, ie /), (/ js, js, je, je /), (/1, kd/), suffix)
708 if ((var_out%num_bcs > 0) .and. (diag_name .ne.
' '))&
725 integer,
dimension(4),
intent(in) :: idim
727 integer,
dimension(4),
intent(in) :: jdim
729 character(len=*),
optional,
intent(in) :: suffix
730 logical,
optional,
intent(in) :: as_needed
733 character(len=*),
parameter :: error_header =&
734 &
'==>Error from coupler_types_mod (CT_spawn_1d_2d):'
735 character(len=400) :: error_msg
738 if (
present(as_needed))
then
740 if ((var%set) .or. (.not.var_in%set))
return
745 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
746 if (.not.var_in%set)&
747 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
750 if(var_in%num_bcs .gt. 0)
then
751 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
752 if(
associated(var_in%bc) )
then
753 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"//&
754 " only one should be associated per type.")
756 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"//&
757 " one must be associated to copy field data.")
762 var%num_bcs = var_in%num_bcs
765 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
766 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
769 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
770 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
773 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
774 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
776 if (var%num_bcs > 0)
then
777 if (
associated(var_in%bc))
then
778 if (
associated(var%bc))
then
779 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
781 allocate ( var%bc(var%num_bcs) )
782 do n = 1, var%num_bcs
783 var%bc(n)%name = var_in%bc(n)%name
784 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
785 var%bc(n)%flux_type = var_in%bc(n)%flux_type
786 var%bc(n)%implementation = var_in%bc(n)%implementation
787 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
788 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
789 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
790 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
791 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
792 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
793 var%bc(n)%num_fields = var_in%bc(n)%num_fields
794 if (
associated(var%bc(n)%field))
then
795 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
798 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
799 do m = 1, var%bc(n)%num_fields
800 if (
present(suffix))
then
801 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
803 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
805 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
806 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
807 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
808 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
809 if (
associated(var%bc(n)%field(m)%values))
then
810 write (error_msg, *) trim(error_header),&
811 &
' var%bc(', n,
')%field(', m,
')%values already associated'
815 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
816 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
819 else if(
associated(var_in%bc_r4))
then
820 if (
associated(var%bc_r4))
then
821 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
823 allocate ( var%bc_r4(var%num_bcs) )
824 do n = 1, var%num_bcs
825 var%bc_r4(n)%name = var_in%bc_r4(n)%name
826 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
827 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
828 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
829 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
830 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
831 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
832 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
833 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
834 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
835 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
836 if (
associated(var%bc_r4(n)%field))
then
837 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
840 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
841 do m = 1, var%bc_r4(n)%num_fields
842 if (
present(suffix))
then
843 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
845 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
847 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
848 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
849 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
850 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
851 if (
associated(var%bc_r4(n)%field(m)%values))
then
852 write (error_msg, *) trim(error_header),&
853 &
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
857 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
858 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
862 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
863 " pointers for both bc and bc_r4")
880 integer,
dimension(4),
intent(in) :: idim
882 integer,
dimension(4),
intent(in) :: jdim
884 integer,
dimension(2),
intent(in) :: kdim
886 character(len=*),
optional,
intent(in) :: suffix
887 logical,
optional,
intent(in) :: as_needed
890 character(len=*),
parameter :: error_header =&
891 &
'==>Error from coupler_types_mod (CT_spawn_1d_3d):'
892 character(len=400) :: error_msg
895 if (
present(as_needed))
then
897 if ((var%set) .or. (.not.var_in%set))
return
902 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
903 if (.not.var_in%set)&
904 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
907 if(var_in%num_bcs .gt. 0)
then
908 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
909 if(
associated(var_in%bc))
then
910 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
911 " only one should be associated per type")
913 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
914 " one must be associated to copy field data")
919 var%num_bcs = var_in%num_bcs
923 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
924 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
927 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
928 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
931 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
932 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
933 var%ks = kdim(1) ; var%ke = kdim(2)
935 if (var%num_bcs > 0)
then
936 if (kdim(1) > kdim(2))
then
937 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
940 if(
associated(var_in%bc))
then
941 if (
associated(var%bc))
then
942 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
944 allocate ( var%bc(var%num_bcs) )
945 do n = 1, var%num_bcs
946 var%bc(n)%name = var_in%bc(n)%name
947 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
948 var%bc(n)%flux_type = var_in%bc(n)%flux_type
949 var%bc(n)%implementation = var_in%bc(n)%implementation
950 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
951 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
952 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
953 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
954 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
955 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
956 var%bc(n)%num_fields = var_in%bc(n)%num_fields
957 if (
associated(var%bc(n)%field))
then
958 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
961 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
962 do m = 1, var%bc(n)%num_fields
963 if (
present(suffix))
then
964 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
966 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
968 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
969 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
970 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
971 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
972 if (
associated(var%bc(n)%field(m)%values))
then
973 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
977 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
978 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
981 else if(
associated(var_in%bc_r4))
then
982 if (
associated(var%bc_r4))
then
983 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
985 allocate ( var%bc_r4(var%num_bcs) )
986 do n = 1, var%num_bcs
987 var%bc_r4(n)%name = var_in%bc_r4(n)%name
988 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
989 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
990 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
991 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
992 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
993 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
994 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
995 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
996 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
997 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
998 if (
associated(var%bc_r4(n)%field))
then
999 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1002 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1003 do m = 1, var%bc_r4(n)%num_fields
1004 if (
present(suffix))
then
1005 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1007 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1009 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1010 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1011 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1012 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1013 if (
associated(var%bc_r4(n)%field(m)%values))
then
1014 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1018 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1019 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1023 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1024 " pointers for both bc and bc_r4")
1042 integer,
dimension(4),
intent(in) :: idim
1044 integer,
dimension(4),
intent(in) :: jdim
1046 character(len=*),
optional,
intent(in) :: suffix
1047 logical,
optional,
intent(in) :: as_needed
1050 character(len=*),
parameter :: error_header =&
1051 &
'==>Error from coupler_types_mod (CT_spawn_2d_2d):'
1052 character(len=400) :: error_msg
1055 if (
present(as_needed))
then
1057 if ((var%set) .or. (.not.var_in%set))
return
1062 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1063 if (.not.var_in%set)&
1064 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1067 if(var_in%num_bcs .gt. 0)
then
1068 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1069 if(
associated(var_in%bc) )
then
1070 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1071 " only one should be associated per type")
1073 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1074 " one must be associated to copy field data")
1079 var%num_bcs = var_in%num_bcs
1082 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1083 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1086 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1087 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1090 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1091 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1093 if (var%num_bcs > 0)
then
1094 if(
associated(var_in%bc))
then
1095 if (
associated(var%bc))
then
1096 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1098 allocate ( var%bc(var%num_bcs) )
1099 do n = 1, var%num_bcs
1100 var%bc(n)%name = var_in%bc(n)%name
1101 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1102 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1103 var%bc(n)%implementation = var_in%bc(n)%implementation
1104 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1105 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1106 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1107 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1108 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1109 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1110 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1111 if (
associated(var%bc(n)%field))
then
1112 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1115 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1116 do m = 1, var%bc(n)%num_fields
1117 if (
present(suffix))
then
1118 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1120 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1122 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1123 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1124 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1125 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1126 if (
associated(var%bc(n)%field(m)%values))
then
1127 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1131 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1132 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
1135 else if (
associated(var_in%bc_r4))
then
1136 if (
associated(var%bc_r4))
then
1137 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1139 allocate ( var%bc_r4(var%num_bcs) )
1140 do n = 1, var%num_bcs
1141 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1142 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1143 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1144 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1145 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1146 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1147 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1148 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1149 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1150 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1151 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1152 if (
associated(var%bc_r4(n)%field))
then
1153 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1156 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1157 do m = 1, var%bc_r4(n)%num_fields
1158 if (
present(suffix))
then
1159 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1161 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1163 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1164 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1165 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1166 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1167 if (
associated(var%bc_r4(n)%field(m)%values))
then
1168 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1172 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1173 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
1177 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1178 " pointers for both bc and bc_r4")
1196 integer,
dimension(4),
intent(in) :: idim
1198 integer,
dimension(4),
intent(in) :: jdim
1200 integer,
dimension(2),
intent(in) :: kdim
1202 character(len=*),
optional,
intent(in) :: suffix
1203 logical,
optional,
intent(in) :: as_needed
1206 character(len=*),
parameter :: error_header =&
1207 &
'==>Error from coupler_types_mod (CT_spawn_2d_3d):'
1208 character(len=400) :: error_msg
1211 if (
present(as_needed))
then
1213 if ((var%set) .or. (.not.var_in%set))
return
1218 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1219 if (.not.var_in%set)&
1220 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1222 if(var_in%num_bcs .gt. 0)
then
1224 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1225 if(
associated(var_in%bc) )
then
1226 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1227 " only one should be associated per type")
1229 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1230 " one must be associated to copy field data")
1235 var%num_bcs = var_in%num_bcs
1239 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1240 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1243 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1244 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1247 if (kdim(1) > kdim(2))
then
1248 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
1251 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1252 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1253 var%ks = kdim(1) ; var%ke = kdim(2)
1255 if (var%num_bcs > 0)
then
1256 if(
associated(var_in%bc))
then
1257 if (
associated(var%bc))
then
1258 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1260 allocate ( var%bc(var%num_bcs) )
1261 do n = 1, var%num_bcs
1262 var%bc(n)%name = var_in%bc(n)%name
1263 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1264 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1265 var%bc(n)%implementation = var_in%bc(n)%implementation
1266 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1267 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1268 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1269 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1270 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1271 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1272 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1273 if (
associated(var%bc(n)%field))
then
1274 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1277 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1278 do m = 1, var%bc(n)%num_fields
1279 if (
present(suffix))
then
1280 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1282 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1284 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1285 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1286 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1287 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1288 if (
associated(var%bc(n)%field(m)%values))
then
1289 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1293 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1294 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
1297 else if(
associated(var_in%bc_r4))
then
1298 if (
associated(var%bc_r4))
then
1299 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1301 allocate ( var%bc_r4(var%num_bcs) )
1302 do n = 1, var%num_bcs
1303 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1304 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1305 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1306 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1307 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1308 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1309 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1310 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1311 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1312 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1313 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1314 if (
associated(var%bc_r4(n)%field))
then
1315 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1318 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1319 do m = 1, var%bc_r4(n)%num_fields
1320 if (
present(suffix))
then
1321 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1323 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1325 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1326 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1327 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1328 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1329 if (
associated(var%bc_r4(n)%field(m)%values))
then
1330 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1334 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1335 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1339 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1340 " pointers for both bc and bc_r4")
1357 integer,
dimension(4),
intent(in) :: idim
1359 integer,
dimension(4),
intent(in) :: jdim
1361 character(len=*),
optional,
intent(in) :: suffix
1362 logical,
optional,
intent(in) :: as_needed
1365 character(len=*),
parameter :: error_header =&
1366 &
'==>Error from coupler_types_mod (CT_spawn_3d_2d):'
1367 character(len=400) :: error_msg
1370 if (
present(as_needed))
then
1372 if ((var%set) .or. (.not.var_in%set))
return
1377 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1378 if (.not.var_in%set)&
1379 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1381 if(var_in%num_bcs .gt. 0)
then
1383 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1384 if(
associated(var_in%bc) )
then
1385 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"// &
1386 " only one should be associated per type")
1388 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both uninitialized,"// &
1389 " one must be associated to copy field data")
1394 var%num_bcs = var_in%num_bcs
1397 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1398 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1401 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1402 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1405 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1406 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1408 if (var%num_bcs > 0)
then
1410 if(
associated(var_in%bc))
then
1411 if (
associated(var%bc))
then
1412 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1414 allocate ( var%bc(var%num_bcs) )
1415 do n = 1, var%num_bcs
1416 var%bc(n)%name = var_in%bc(n)%name
1417 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1418 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1419 var%bc(n)%implementation = var_in%bc(n)%implementation
1420 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1421 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1422 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1423 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1424 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1425 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1426 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1427 if (
associated(var%bc(n)%field))
then
1428 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1431 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1432 do m = 1, var%bc(n)%num_fields
1433 if (
present(suffix))
then
1434 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1436 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1438 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1439 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1440 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1441 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1442 if (
associated(var%bc(n)%field(m)%values))
then
1443 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1447 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1448 var%bc(n)%field(m)%values(:,:) = 0.0_r8_kind
1452 else if (
associated(var_in%bc_r4))
then
1453 if (
associated(var%bc_r4))
then
1454 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1456 allocate ( var%bc_r4(var%num_bcs) )
1457 do n = 1, var%num_bcs
1458 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1459 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1460 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1461 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1462 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1463 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1464 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1465 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1466 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1467 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1468 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1469 if (
associated(var%bc_r4(n)%field))
then
1470 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1473 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1474 do m = 1, var%bc_r4(n)%num_fields
1475 if (
present(suffix))
then
1476 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1478 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1480 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1481 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1482 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1483 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1484 if (
associated(var%bc_r4(n)%field(m)%values))
then
1485 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1489 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed) )
1490 var%bc_r4(n)%field(m)%values(:,:) = 0.0_r4_kind
1494 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1495 " pointers for both bc and bc_r4")
1513 integer,
dimension(4),
intent(in) :: idim
1515 integer,
dimension(4),
intent(in) :: jdim
1517 integer,
dimension(2),
intent(in) :: kdim
1519 character(len=*),
optional,
intent(in) :: suffix
1520 logical,
optional,
intent(in) :: as_needed
1523 character(len=*),
parameter :: error_header =&
1524 &
'==>Error from coupler_types_mod (CT_spawn_3d_3d):'
1525 character(len=400) :: error_msg
1528 if (
present(as_needed))
then
1530 if ((var%set) .or. (.not.var_in%set))
return
1535 &
call mpp_error(fatal, trim(error_header) //
' The output type has already been initialized.')
1536 if (.not.var_in%set)&
1537 &
call mpp_error(fatal, trim(error_header) //
' The parent type has not been initialized.')
1539 if(var_in%num_bcs .gt. 0)
then
1541 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1542 if(
associated(var_in%bc))
then
1543 call mpp_error(fatal, error_header//
"var_in%bc and var_in%bc_r4 are both initialized,"//&
1544 "only one should be allocated per type")
1546 call mpp_error(fatal, error_header//
"var_in%bc and var%bc_r4 are both uninitialized,"//&
1547 " one must be associated to copy field data")
1552 var%num_bcs = var_in%num_bcs
1555 if ((idim(1) > idim(2)) .or. (idim(3) > idim(4)))
then
1556 write (error_msg, *) trim(error_header),
' Disordered i-dimension index bound list ', idim
1559 if ((jdim(1) > jdim(2)) .or. (jdim(3) > jdim(4)))
then
1560 write (error_msg, *) trim(error_header),
' Disordered j-dimension index bound list ', jdim
1563 if (kdim(1) > kdim(2))
then
1564 write (error_msg, *) trim(error_header),
' Disordered k-dimension index bound list ', kdim
1567 var%isd = idim(1) ; var%isc = idim(2) ; var%iec = idim(3) ; var%ied = idim(4)
1568 var%jsd = jdim(1) ; var%jsc = jdim(2) ; var%jec = jdim(3) ; var%jed = jdim(4)
1569 var%ks = kdim(1) ; var%ke = kdim(2)
1571 if (var%num_bcs > 0)
then
1572 if(
associated(var_in%bc))
then
1573 if (
associated(var%bc))
then
1574 call mpp_error(fatal, trim(error_header) //
' var%bc already associated')
1576 allocate ( var%bc(var%num_bcs) )
1577 do n = 1, var%num_bcs
1578 var%bc(n)%name = var_in%bc(n)%name
1579 var%bc(n)%atm_tr_index = var_in%bc(n)%atm_tr_index
1580 var%bc(n)%flux_type = var_in%bc(n)%flux_type
1581 var%bc(n)%implementation = var_in%bc(n)%implementation
1582 var%bc(n)%ice_restart_file = var_in%bc(n)%ice_restart_file
1583 var%bc(n)%ocean_restart_file = var_in%bc(n)%ocean_restart_file
1584 var%bc(n)%use_atm_pressure = var_in%bc(n)%use_atm_pressure
1585 var%bc(n)%use_10m_wind_speed = var_in%bc(n)%use_10m_wind_speed
1586 var%bc(n)%pass_through_ice = var_in%bc(n)%pass_through_ice
1587 var%bc(n)%mol_wt = var_in%bc(n)%mol_wt
1588 var%bc(n)%num_fields = var_in%bc(n)%num_fields
1589 if (
associated(var%bc(n)%field))
then
1590 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field already associated'
1593 allocate ( var%bc(n)%field(var%bc(n)%num_fields) )
1594 do m = 1, var%bc(n)%num_fields
1595 if (
present(suffix))
then
1596 var%bc(n)%field(m)%name = trim(var_in%bc(n)%field(m)%name) // trim(suffix)
1598 var%bc(n)%field(m)%name = var_in%bc(n)%field(m)%name
1600 var%bc(n)%field(m)%long_name = var_in%bc(n)%field(m)%long_name
1601 var%bc(n)%field(m)%units = var_in%bc(n)%field(m)%units
1602 var%bc(n)%field(m)%may_init = var_in%bc(n)%field(m)%may_init
1603 var%bc(n)%field(m)%mean = var_in%bc(n)%field(m)%mean
1604 if (
associated(var%bc(n)%field(m)%values))
then
1605 write (error_msg, *) trim(error_header),
' var%bc(', n,
')%field(', m,
')%values already associated'
1610 allocate ( var%bc(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1611 var%bc(n)%field(m)%values(:,:,:) = 0.0_r8_kind
1614 else if(
associated(var_in%bc_r4))
then
1615 if (
associated(var%bc_r4))
then
1616 call mpp_error(fatal, trim(error_header) //
' var%bc_r4 already associated')
1618 allocate ( var%bc_r4(var%num_bcs) )
1619 do n = 1, var%num_bcs
1620 var%bc_r4(n)%name = var_in%bc_r4(n)%name
1621 var%bc_r4(n)%atm_tr_index = var_in%bc_r4(n)%atm_tr_index
1622 var%bc_r4(n)%flux_type = var_in%bc_r4(n)%flux_type
1623 var%bc_r4(n)%implementation = var_in%bc_r4(n)%implementation
1624 var%bc_r4(n)%ice_restart_file = var_in%bc_r4(n)%ice_restart_file
1625 var%bc_r4(n)%ocean_restart_file = var_in%bc_r4(n)%ocean_restart_file
1626 var%bc_r4(n)%use_atm_pressure = var_in%bc_r4(n)%use_atm_pressure
1627 var%bc_r4(n)%use_10m_wind_speed = var_in%bc_r4(n)%use_10m_wind_speed
1628 var%bc_r4(n)%pass_through_ice = var_in%bc_r4(n)%pass_through_ice
1629 var%bc_r4(n)%mol_wt = var_in%bc_r4(n)%mol_wt
1630 var%bc_r4(n)%num_fields = var_in%bc_r4(n)%num_fields
1631 if (
associated(var%bc_r4(n)%field))
then
1632 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field already associated'
1635 allocate ( var%bc_r4(n)%field(var%bc_r4(n)%num_fields) )
1636 do m = 1, var%bc_r4(n)%num_fields
1637 if (
present(suffix))
then
1638 var%bc_r4(n)%field(m)%name = trim(var_in%bc_r4(n)%field(m)%name) // trim(suffix)
1640 var%bc_r4(n)%field(m)%name = var_in%bc_r4(n)%field(m)%name
1642 var%bc_r4(n)%field(m)%long_name = var_in%bc_r4(n)%field(m)%long_name
1643 var%bc_r4(n)%field(m)%units = var_in%bc_r4(n)%field(m)%units
1644 var%bc_r4(n)%field(m)%may_init = var_in%bc_r4(n)%field(m)%may_init
1645 var%bc_r4(n)%field(m)%mean = var_in%bc_r4(n)%field(m)%mean
1646 if (
associated(var%bc_r4(n)%field(m)%values))
then
1647 write (error_msg, *) trim(error_header),
' var%bc_r4(', n,
')%field(', m,
')%values already associated'
1652 allocate ( var%bc_r4(n)%field(m)%values(var%isd:var%ied,var%jsd:var%jed,var%ks:var%ke) )
1653 var%bc_r4(n)%field(m)%values(:,:,:) = 0.0_r4_kind
1657 call mpp_error(fatal, error_header//
"passed in type has unassociated coupler_field_type"// &
1658 " pointers for both bc and bc_r4")
1676 & exclude_flux_type, only_flux_type, pass_through_ice)
1679 integer,
optional,
intent(in) :: halo_size
1680 integer,
optional,
intent(in) :: bc_index
1682 integer,
optional,
intent(in) :: field_index
1684 character(len=*),
optional,
intent(in) :: exclude_flux_type
1686 character(len=*),
optional,
intent(in) :: only_flux_type
1688 logical,
optional,
intent(in) :: pass_through_ice
1691 integer :: i, j, m, n, n1, n2, halo, i_off, j_off
1694 if (
present(bc_index))
then
1695 if (bc_index > var_in%num_bcs)&
1696 &
call mpp_error(fatal,
"CT_copy_data_2d: bc_index is present and exceeds var_in%num_bcs.")
1697 if (
present(field_index))
then
1698 if(
associated(var_in%bc))
then
1699 if (field_index > var_in%bc(bc_index)%num_fields)&
1700 &
call mpp_error(fatal,
"CT_copy_data_2d: field_index is present and exceeds num_fields for" //&
1701 & trim(var_in%bc(bc_index)%name) )
1703 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
1704 &
call mpp_error(fatal,
"CT_copy_data_2d: field_index is present and exceeds num_fields for" //&
1705 & trim(var_in%bc_r4(bc_index)%name) )
1708 elseif (
present(field_index))
then
1709 call mpp_error(fatal,
"CT_copy_data_2d: bc_index must be present if field_index is present.")
1713 if (
present(halo_size)) halo = halo_size
1717 if (
present(bc_index))
then
1724 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
1725 &
call mpp_error(fatal,
"CT_copy_data_2d: There is an i-direction computational domain size mismatch.")
1726 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
1727 &
call mpp_error(fatal,
"CT_copy_data_2d: There is a j-direction computational domain size mismatch.")
1728 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
1729 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive i-direction halo size for the input structure.")
1730 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
1731 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive j-direction halo size for the input structure.")
1732 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
1733 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive i-direction halo size for the output structure.")
1734 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
1735 &
call mpp_error(fatal,
"CT_copy_data_2d: Excessive j-direction halo size for the output structure.")
1737 i_off = var_in%isc - var%isc
1738 j_off = var_in%jsc - var%jsc
1741 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
1742 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1743 if(
associated(var_in%bc) )
then
1744 call mpp_error(fatal,
"CT_copy_data_2d var_in%bc and var_in%bc_r4 are both initialized,"//&
1745 " only one should be associated per type")
1747 call mpp_error(fatal,
"CT_copy_data_2d var_in%bc and var_in%bc_r4 are both uninitialized,"//&
1748 " one must be associated to copy field data.")
1754 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
1757 if (copy_bc .and.
present(exclude_flux_type))&
1758 & copy_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
1759 if (copy_bc .and.
present(only_flux_type))&
1760 & copy_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
1761 if (copy_bc .and.
present(pass_through_ice))&
1762 & copy_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
1763 if (.not.copy_bc) cycle
1765 do m = 1, var%bc(n)%num_fields
1766 if (
present(field_index))
then
1767 if (m /= field_index) cycle
1769 if (
associated(var%bc(n)%field(m)%values) )
then
1770 do j=var%jsc-halo,var%jec+halo
1771 do i=var%isc-halo,var%iec+halo
1772 var%bc(n)%field(m)%values(i,j) = var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
1778 else if (
associated(var_in%bc_r4))
then
1781 if (copy_bc .and.
present(exclude_flux_type))&
1782 & copy_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
1783 if (copy_bc .and.
present(only_flux_type))&
1784 & copy_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
1785 if (copy_bc .and.
present(pass_through_ice))&
1786 & copy_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
1787 if (.not.copy_bc) cycle
1789 do m = 1, var%bc_r4(n)%num_fields
1790 if (
present(field_index))
then
1791 if (m /= field_index) cycle
1793 if (
associated(var%bc_r4(n)%field(m)%values) )
then
1794 do j=var%jsc-halo,var%jec+halo
1795 do i=var%isc-halo,var%iec+halo
1796 var%bc_r4(n)%field(m)%values(i,j) = var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
1803 call mpp_error(fatal,
"CT_copy_data_2d: passed in type has unassociated coupler_field_type"// &
1804 " pointers for both bc and bc_r4")
1823 & exclude_flux_type, only_flux_type, pass_through_ice)
1826 integer,
optional,
intent(in) :: halo_size
1827 integer,
optional,
intent(in) :: bc_index
1829 integer,
optional,
intent(in) :: field_index
1831 character(len=*),
optional,
intent(in) :: exclude_flux_type
1833 character(len=*),
optional,
intent(in) :: only_flux_type
1835 logical,
optional,
intent(in) :: pass_through_ice
1838 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, k_off
1840 if (
present(bc_index))
then
1841 if (bc_index > var_in%num_bcs) &
1842 call mpp_error(fatal,
"CT_copy_data_3d: bc_index is present and exceeds var_in%num_bcs.")
1843 if (
present(field_index))
then
1844 if(
associated(var_in%bc))
then
1845 if (field_index > var_in%bc(bc_index)%num_fields)&
1846 &
call mpp_error(fatal,
"CT_copy_data_3d: field_index is present and exceeds num_fields for" //&
1847 & trim(var_in%bc(bc_index)%name) )
1849 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
1850 &
call mpp_error(fatal,
"CT_copy_data_3d: field_index is present and exceeds num_fields for" //&
1851 & trim(var_in%bc_r4(bc_index)%name) )
1854 elseif (
present(field_index))
then
1855 call mpp_error(fatal,
"CT_copy_data_3d: bc_index must be present if field_index is present.")
1859 if (
present(halo_size)) halo = halo_size
1863 if (
present(bc_index))
then
1870 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
1871 &
call mpp_error(fatal,
"CT_copy_data_3d: There is an i-direction computational domain size mismatch.")
1872 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
1873 &
call mpp_error(fatal,
"CT_copy_data_3d: There is a j-direction computational domain size mismatch.")
1874 if ((var_in%ke-var_in%ks) /= (var%ke-var%ks))&
1875 &
call mpp_error(fatal,
"CT_copy_data_3d: There is a k-direction computational domain size mismatch.")
1876 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
1877 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive i-direction halo size for the input structure.")
1878 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
1879 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive j-direction halo size for the input structure.")
1880 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
1881 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive i-direction halo size for the output structure.")
1882 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
1883 &
call mpp_error(fatal,
"CT_copy_data_3d: Excessive j-direction halo size for the output structure.")
1885 i_off = var_in%isc - var%isc
1886 j_off = var_in%jsc - var%jsc
1887 k_off = var_in%ks - var%ks
1890 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
1891 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
1892 if(
associated(var_in%bc) )
then
1893 call mpp_error(fatal,
"CT_copy_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
1894 " only one should be associated per type")
1896 call mpp_error(fatal,
"CT_copy_data_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
1897 " one must be associated to copy field data.")
1903 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
1906 if (copy_bc .and.
present(exclude_flux_type))&
1907 & copy_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
1908 if (copy_bc .and.
present(only_flux_type))&
1909 & copy_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
1910 if (copy_bc .and.
present(pass_through_ice))&
1911 & copy_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
1912 if (.not.copy_bc) cycle
1914 do m = 1, var_in%bc(n)%num_fields
1915 if (
present(field_index))
then
1916 if (m /= field_index) cycle
1918 if (
associated(var%bc(n)%field(m)%values) )
then
1920 do j=var%jsc-halo,var%jec+halo
1921 do i=var%isc-halo,var%iec+halo
1922 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)
1929 else if (
associated(var_in%bc_r4))
then
1932 if (copy_bc .and.
present(exclude_flux_type))&
1933 & copy_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
1934 if (copy_bc .and.
present(only_flux_type))&
1935 & copy_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
1936 if (copy_bc .and.
present(pass_through_ice))&
1937 & copy_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
1938 if (.not.copy_bc) cycle
1940 do m = 1, var_in%bc_r4(n)%num_fields
1941 if (
present(field_index))
then
1942 if (m /= field_index) cycle
1944 if (
associated(var%bc_r4(n)%field(m)%values) )
then
1946 do j=var%jsc-halo,var%jec+halo
1947 do i=var%isc-halo,var%iec+halo
1948 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)
1956 call mpp_error(fatal,
"CT_copy_data_3d: passed in type has unassociated coupler_field_type"// &
1957 " pointers for both bc and bc_r4")
1975 & exclude_flux_type, only_flux_type, pass_through_ice,&
1976 & ind3_start, ind3_end)
1979 integer,
optional,
intent(in) :: halo_size
1980 integer,
optional,
intent(in) :: bc_index
1982 integer,
optional,
intent(in) :: field_index
1984 character(len=*),
optional,
intent(in) :: exclude_flux_type
1986 character(len=*),
optional,
intent(in) :: only_flux_type
1988 logical,
optional,
intent(in) :: pass_through_ice
1990 integer,
optional,
intent(in) :: ind3_start
1992 integer,
optional,
intent(in) :: ind3_end
1996 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, ks, ke
1998 if (
present(bc_index))
then
1999 if (bc_index > var_in%num_bcs)&
2000 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: bc_index is present and exceeds var_in%num_bcs.")
2001 if (
present(field_index))
then ;
if (field_index > var_in%bc(bc_index)%num_fields)&
2002 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: field_index is present and exceeds num_fields for" //&
2003 & trim(var_in%bc(bc_index)%name) )
2005 elseif (
present(field_index))
then
2006 call mpp_error(fatal,
"CT_copy_data_2d_3d: bc_index must be present if field_index is present.")
2010 if (
present(halo_size)) halo = halo_size
2014 if (
present(bc_index))
then
2021 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2022 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: There is an i-direction computational domain size mismatch.")
2023 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2024 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: There is a j-direction computational domain size mismatch.")
2025 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2026 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive i-direction halo size for the input structure.")
2027 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2028 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive j-direction halo size for the input structure.")
2029 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2030 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive i-direction halo size for the output structure.")
2031 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2032 &
call mpp_error(fatal,
"CT_copy_data_2d_3d: Excessive j-direction halo size for the output structure.")
2035 i_off = var_in%isc - var%isc
2036 j_off = var_in%jsc - var%jsc
2038 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2039 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2040 if(
associated(var_in%bc) )
then
2041 call mpp_error(fatal,
"CT_copy_data_2d_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2042 " only one should be associated per type")
2044 call mpp_error(fatal,
"CT_copy_data_2d_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
2045 " one must be associated to copy field data.")
2052 if (
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2055 if (copy_bc .and.
present(exclude_flux_type))&
2056 & copy_bc = .not.(trim(var_in%bc(n)%flux_type) == trim(exclude_flux_type))
2057 if (copy_bc .and.
present(only_flux_type))&
2058 & copy_bc = (trim(var_in%bc(n)%flux_type) == trim(only_flux_type))
2059 if (copy_bc .and.
present(pass_through_ice))&
2060 & copy_bc = (pass_through_ice .eqv. var_in%bc(n)%pass_through_ice)
2061 if (.not.copy_bc) cycle
2063 do m = 1, var_in%bc(n)%num_fields
2064 if (
present(field_index))
then
2065 if (m /= field_index) cycle
2067 if (
associated(var%bc(n)%field(m)%values) )
then
2069 if (
present(ind3_start)) ks = max(ks, ind3_start)
2071 if (
present(ind3_end)) ke = max(ke, ind3_end)
2073 do j=var%jsc-halo,var%jec+halo
2074 do i=var%isc-halo,var%iec+halo
2075 var%bc(n)%field(m)%values(i,j,k) = var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
2083 else if (
associated(var_in%bc_r4))
then
2086 if (copy_bc .and.
present(exclude_flux_type))&
2087 & copy_bc = .not.(trim(var_in%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2088 if (copy_bc .and.
present(only_flux_type))&
2089 & copy_bc = (trim(var_in%bc_r4(n)%flux_type) == trim(only_flux_type))
2090 if (copy_bc .and.
present(pass_through_ice))&
2091 & copy_bc = (pass_through_ice .eqv. var_in%bc_r4(n)%pass_through_ice)
2092 if (.not.copy_bc) cycle
2094 do m = 1, var_in%bc_r4(n)%num_fields
2095 if (
present(field_index))
then
2096 if (m /= field_index) cycle
2098 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2100 if (
present(ind3_start)) ks = max(ks, ind3_start)
2102 if (
present(ind3_end)) ke = max(ke, ind3_end)
2104 do j=var%jsc-halo,var%jec+halo
2105 do i=var%isc-halo,var%iec+halo
2106 var%bc_r4(n)%field(m)%values(i,j,k) = var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
2114 call mpp_error(fatal,
"CT_copy_data_2d_3d: passed in type has unassociated coupler_field_type"// &
2115 " pointers for both bc and bc_r4")
2129 type(
domain2d),
intent(in) :: domain_in
2131 type(
domain2d),
intent(in) :: domain_out
2132 logical,
optional,
intent(in) :: complete
2134 real(r4_kind),
pointer,
dimension(:,:) :: null_ptr2D_r4 => null()
2135 real(r8_kind),
pointer,
dimension(:,:) :: null_ptr2D_r8 => null()
2136 logical :: do_in, do_out, do_complete
2137 integer :: m, n, fc, fc_in, fc_out
2139 do_complete = .true.
2140 if (
present(complete)) do_complete = complete
2144 do_out = var_out%set
2146 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2147 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2148 if(
associated(var_in%bc) )
then
2149 call mpp_error(fatal,
"CT_redistribute_data_2d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2150 " only one should be associated per type")
2152 call mpp_error(fatal,
"CT_redistribute_data_2d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2153 " only one must be associated per type to redistribute field data.")
2159 if(
associated(var_in%bc) .or.
associated(var_out%bc) .or. var_in%num_bcs .lt. 1)
then
2160 fc_in = 0 ; fc_out = 0
2162 do n = 1, var_in%num_bcs
2163 do m = 1, var_in%bc(n)%num_fields
2164 if (
associated(var_in%bc(n)%field(m)%values)) fc_in = fc_in + 1
2168 if (fc_in == 0) do_in = .false.
2170 do n = 1, var_out%num_bcs
2171 do m = 1, var_out%bc(n)%num_fields
2172 if (
associated(var_out%bc(n)%field(m)%values)) fc_out = fc_out + 1
2176 if (fc_out == 0) do_out = .false.
2178 if (do_in .and. do_out)
then
2179 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2180 &
"Mismatch in num_bcs in CT_copy_data_2d.")
2181 if (fc_in /= fc_out)
call mpp_error(fatal,&
2182 &
"Mismatch in the total number of fields in CT_redistribute_data_2d.")
2185 if (.not.(do_in .or. do_out))
return
2188 if (do_in .and. do_out)
then
2189 do n = 1, var_in%num_bcs
2190 do m = 1, var_in%bc(n)%num_fields
2191 if (
associated(var_in%bc(n)%field(m)%values) .neqv.&
2192 &
associated(var_out%bc(n)%field(m)%values) ) &
2194 &
"CT_redistribute_data_2d: Mismatch in which var_in and var_out fields are associated"// &
2195 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2196 if (
associated(var_in%bc(n)%field(m)%values) )
then
2199 & domain_out, var_out%bc(n)%field(m)%values,&
2200 & complete=(do_complete.and.(fc==fc_in)) )
2205 do n = 1, var_in%num_bcs
2206 do m = 1, var_in%bc(n)%num_fields
2207 if (
associated(var_in%bc(n)%field(m)%values) )
then
2210 & domain_out, null_ptr2d_r8,&
2211 & complete=(do_complete.and.(fc==fc_in)) )
2215 elseif (do_out)
then
2216 do n = 1, var_out%num_bcs
2217 do m = 1, var_out%bc(n)%num_fields
2218 if (
associated(var_out%bc(n)%field(m)%values) )
then
2221 & domain_out, var_out%bc(n)%field(m)%values,&
2222 & complete=(do_complete.and.(fc==fc_out)) )
2228 else if(
associated(var_in%bc_r4) .or.
associated(var_out%bc_r4))
then
2229 fc_in = 0 ; fc_out = 0
2231 do n = 1, var_in%num_bcs
2232 do m = 1, var_in%bc_r4(n)%num_fields
2233 if (
associated(var_in%bc_r4(n)%field(m)%values)) fc_in = fc_in + 1
2237 if (fc_in == 0) do_in = .false.
2239 do n = 1, var_out%num_bcs
2240 do m = 1, var_out%bc_r4(n)%num_fields
2241 if (
associated(var_out%bc_r4(n)%field(m)%values)) fc_out = fc_out + 1
2245 if (fc_out == 0) do_out = .false.
2247 if (do_in .and. do_out)
then
2248 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2249 &
"Mismatch in num_bcs in CT_copy_data_2d.")
2250 if (fc_in /= fc_out)
call mpp_error(fatal,&
2251 &
"Mismatch in the total number of fields in CT_redistribute_data_2d.")
2254 if (.not.(do_in .or. do_out))
return
2257 if (do_in .and. do_out)
then
2258 do n = 1, var_in%num_bcs
2259 do m = 1, var_in%bc_r4(n)%num_fields
2260 if (
associated(var_in%bc_r4(n)%field(m)%values) .neqv.&
2261 &
associated(var_out%bc_r4(n)%field(m)%values) ) &
2263 &
"CT_redistribute_data_2d: Mismatch in which var_in and var_out fields are associated"// &
2264 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2265 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2268 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2269 & complete=(do_complete.and.(fc==fc_in)) )
2274 do n = 1, var_in%num_bcs
2275 do m = 1, var_in%bc_r4(n)%num_fields
2276 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2279 & domain_out, null_ptr2d_r4,&
2280 & complete=(do_complete.and.(fc==fc_in)) )
2284 elseif (do_out)
then
2285 do n = 1, var_out%num_bcs
2286 do m = 1, var_out%bc_r4(n)%num_fields
2287 if (
associated(var_out%bc_r4(n)%field(m)%values) )
then
2290 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2291 & complete=(do_complete.and.(fc==fc_out)) )
2297 call mpp_error(fatal,
"CT_redistribute_data_2d: passed in type has unassociated coupler_field_type"// &
2298 " pointers for both bc and bc_r4")
2308 type(
domain2d),
intent(in) :: domain_in
2310 type(
domain2d),
intent(in) :: domain_out
2311 logical,
optional,
intent(in) :: complete
2313 real(r4_kind),
pointer,
dimension(:,:,:) :: null_ptr3D_r4 => null()
2314 real(r8_kind),
pointer,
dimension(:,:,:) :: null_ptr3D_r8 => null()
2315 logical :: do_in, do_out, do_complete
2316 integer :: m, n, fc, fc_in, fc_out
2318 do_complete = .true.
2319 if (
present(complete)) do_complete = complete
2323 do_out = var_out%set
2328 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2329 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2330 if(
associated(var_in%bc) )
then
2331 call mpp_error(fatal,
"CT_redistribute_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2332 " only one should be associated per type")
2334 call mpp_error(fatal,
"CT_redistribute_data_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2335 " only one must be associated per type to redistribute field data.")
2341 if(
associated(var_in%bc) .or.
associated(var_out%bc) .or. var_in%num_bcs .lt. 1)
then
2343 do n = 1, var_in%num_bcs
2344 do m = 1, var_in%bc(n)%num_fields
2345 if (
associated(var_in%bc(n)%field(m)%values)) fc_in = fc_in + 1
2349 if (fc_in == 0) do_in = .false.
2351 do n = 1, var_out%num_bcs
2352 do m = 1, var_out%bc(n)%num_fields
2353 if (
associated(var_out%bc(n)%field(m)%values)) fc_out = fc_out + 1
2357 if (fc_out == 0) do_out = .false.
2359 if (do_in .and. do_out)
then
2360 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2361 &
"Mismatch in num_bcs in CT_copy_data_3d.")
2362 if (fc_in /= fc_out)
call mpp_error(fatal,&
2363 &
"Mismatch in the total number of fields in CT_redistribute_data_3d.")
2366 if (.not.(do_in .or. do_out))
return
2369 if (do_in .and. do_out)
then
2370 do n = 1, var_in%num_bcs
2371 do m = 1, var_in%bc(n)%num_fields
2372 if (
associated(var_in%bc(n)%field(m)%values) .neqv.&
2373 &
associated(var_out%bc(n)%field(m)%values) )&
2375 &
"CT_redistribute_data_3d: Mismatch in which var_in and var_out fields are associated"// &
2376 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2377 if (
associated(var_in%bc(n)%field(m)%values) )
then
2380 & domain_out, var_out%bc(n)%field(m)%values,&
2381 & complete=(do_complete.and.(fc==fc_in)) )
2386 do n = 1, var_in%num_bcs
2387 do m = 1, var_in%bc(n)%num_fields
2388 if (
associated(var_in%bc(n)%field(m)%values) )
then
2391 & domain_out, null_ptr3d_r8,&
2392 & complete=(do_complete.and.(fc==fc_in)) )
2396 elseif (do_out)
then
2397 do n = 1, var_out%num_bcs
2398 do m = 1, var_out%bc(n)%num_fields
2399 if (
associated(var_out%bc(n)%field(m)%values) )
then
2402 & domain_out, var_out%bc(n)%field(m)%values,&
2403 & complete=(do_complete.and.(fc==fc_out)) )
2409 else if(
associated(var_in%bc_r4) .or.
associated(var_out%bc_r4))
then
2411 do n = 1, var_in%num_bcs
2412 do m = 1, var_in%bc_r4(n)%num_fields
2413 if (
associated(var_in%bc_r4(n)%field(m)%values)) fc_in = fc_in + 1
2417 if (fc_in == 0) do_in = .false.
2419 do n = 1, var_out%num_bcs
2420 do m = 1, var_out%bc_r4(n)%num_fields
2421 if (
associated(var_out%bc_r4(n)%field(m)%values)) fc_out = fc_out + 1
2425 if (fc_out == 0) do_out = .false.
2427 if (do_in .and. do_out)
then
2428 if (var_in%num_bcs /= var_out%num_bcs)
call mpp_error(fatal,&
2429 &
"Mismatch in num_bcs in CT_copy_data_3d.")
2430 if (fc_in /= fc_out)
call mpp_error(fatal,&
2431 &
"Mismatch in the total number of fields in CT_redistribute_data_3d.")
2434 if (.not.(do_in .or. do_out))
return
2437 if (do_in .and. do_out)
then
2438 do n = 1, var_in%num_bcs
2439 do m = 1, var_in%bc_r4(n)%num_fields
2440 if (
associated(var_in%bc_r4(n)%field(m)%values) .neqv.&
2441 &
associated(var_out%bc_r4(n)%field(m)%values) )&
2443 &
"CT_redistribute_data_3d: Mismatch in which var_in and var_out fields are associated"// &
2444 &
"Boundary condition:"//
string(n)//
" Field:"//
string(m))
2445 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2448 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2449 & complete=(do_complete.and.(fc==fc_in)) )
2454 do n = 1, var_in%num_bcs
2455 do m = 1, var_in%bc_r4(n)%num_fields
2456 if (
associated(var_in%bc_r4(n)%field(m)%values) )
then
2459 & domain_out, null_ptr3d_r4,&
2460 & complete=(do_complete.and.(fc==fc_in)) )
2464 elseif (do_out)
then
2465 do n = 1, var_out%num_bcs
2466 do m = 1, var_out%bc_r4(n)%num_fields
2467 if (
associated(var_out%bc_r4(n)%field(m)%values) )
then
2470 & domain_out, var_out%bc_r4(n)%field(m)%values,&
2471 & complete=(do_complete.and.(fc==fc_out)) )
2477 call mpp_error(fatal,
"CT_redistribute_data_3d: passed in type has unassociated coupler_field_type"// &
2478 " pointers for both bc and bc_r4")
2498 & scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
2501 integer,
optional,
intent(in) :: halo_size
2502 integer,
optional,
intent(in) :: bc_index
2504 integer,
optional,
intent(in) :: field_index
2506 real(r8_kind),
optional,
intent(in) :: scale_factor
2507 real(r8_kind),
optional,
intent(in) :: scale_prev
2508 character(len=*),
optional,
intent(in) :: exclude_flux_type
2510 character(len=*),
optional,
intent(in) :: only_flux_type
2512 logical,
optional,
intent(in) :: pass_through_ice
2515 real(r8_kind) :: scale, sc_prev
2516 logical :: increment_bc
2517 integer :: i, j, m, n, n1, n2, halo, i_off, j_off
2520 if (
present(scale_factor)) scale = scale_factor
2521 sc_prev = 1.0_r8_kind
2522 if (
present(scale_prev)) sc_prev = scale_prev
2524 if (
present(bc_index))
then
2525 if (bc_index > var_in%num_bcs)&
2526 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: bc_index is present and exceeds var_in%num_bcs.")
2527 if (
present(field_index))
then
2528 if(
associated(var_in%bc))
then
2529 if (field_index > var_in%bc(bc_index)%num_fields)&
2530 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: field_index is present and exceeds num_fields for" //&
2531 & trim(var_in%bc(bc_index)%name) )
2533 if (field_index > var_in%bc_r4(bc_index)%num_fields)&
2534 &
call mpp_error(fatal,
"CT_increment_data_2d_2d: field_index is present and exceeds num_fields for" //&
2535 & trim(var_in%bc_r4(bc_index)%name) )
2538 elseif (
present(field_index))
then
2539 call mpp_error(fatal,
"CT_increment_data_2d_2d: bc_index must be present if field_index is present.")
2543 if (
present(halo_size)) halo = halo_size
2547 if (
present(bc_index))
then
2554 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2555 &
call mpp_error(fatal,
"CT_increment_data_2d: There is an i-direction computational domain size mismatch.")
2556 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2557 &
call mpp_error(fatal,
"CT_increment_data_2d: There is a j-direction computational domain size mismatch.")
2558 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2559 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive i-direction halo size for the input structure.")
2560 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2561 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive j-direction halo size for the input structure.")
2562 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2563 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive i-direction halo size for the output structure.")
2564 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2565 &
call mpp_error(fatal,
"CT_increment_data_2d: Excessive j-direction halo size for the output structure.")
2567 i_off = var_in%isc - var%isc
2568 j_off = var_in%jsc - var%jsc
2572 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2573 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2574 if(
associated(var_in%bc) )
then
2575 call mpp_error(fatal,
"CT_increment_data_2d_2d: var_in%bc and var_in%bc_r4 are both initialized,"// &
2576 " only one should be associated per type")
2578 call mpp_error(fatal,
"CT_increment_data_2d_2d: var_in%bc and var_in%bc_r4 are both initialized,"// &
2579 " only one must be associated per type to increment field data.")
2585 if(
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2587 increment_bc = .true.
2588 if (increment_bc .and.
present(exclude_flux_type))&
2589 & increment_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
2590 if (increment_bc .and.
present(only_flux_type))&
2591 & increment_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
2592 if (increment_bc .and.
present(pass_through_ice))&
2593 & increment_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
2594 if (.not.increment_bc) cycle
2596 do m = 1, var_in%bc(n)%num_fields
2597 if (
present(field_index))
then
2598 if (m /= field_index) cycle
2600 if (
associated(var%bc(n)%field(m)%values) )
then
2601 do j=var%jsc-halo,var%jec+halo
2602 do i=var%isc-halo,var%iec+halo
2603 var%bc(n)%field(m)%values(i,j) = sc_prev * var%bc(n)%field(m)%values(i,j) +&
2604 & scale * var_in%bc(n)%field(m)%values(i+i_off,j+j_off)
2610 else if(
associated(var_in%bc_r4))
then
2612 increment_bc = .true.
2613 if (increment_bc .and.
present(exclude_flux_type))&
2614 & increment_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2615 if (increment_bc .and.
present(only_flux_type))&
2616 & increment_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
2617 if (increment_bc .and.
present(pass_through_ice))&
2618 & increment_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
2619 if (.not.increment_bc) cycle
2621 do m = 1, var_in%bc_r4(n)%num_fields
2622 if (
present(field_index))
then
2623 if (m /= field_index) cycle
2625 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2626 do j=var%jsc-halo,var%jec+halo
2627 do i=var%isc-halo,var%iec+halo
2628 var%bc_r4(n)%field(m)%values(i,j) = real(sc_prev,r4_kind) * var%bc_r4(n)%field(m)%values(i,j) +&
2629 & real(scale,r4_kind) * var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off)
2636 call mpp_error(fatal,
"CT_increment_data_2d_2d: passed in type has unassociated coupler_field_type"// &
2637 " pointers for both bc and bc_r4")
2657 & scale_factor, scale_prev, exclude_flux_type, only_flux_type, pass_through_ice)
2660 integer,
optional,
intent(in) :: halo_size
2661 integer,
optional,
intent(in) :: bc_index
2663 integer,
optional,
intent(in) :: field_index
2665 real(r8_kind),
optional,
intent(in) :: scale_factor
2666 real(r8_kind),
optional,
intent(in) :: scale_prev
2667 character(len=*),
optional,
intent(in) :: exclude_flux_type
2669 character(len=*),
optional,
intent(in) :: only_flux_type
2671 logical,
optional,
intent(in) :: pass_through_ice
2674 real(r8_kind) :: scale, sc_prev
2675 logical :: increment_bc
2676 integer :: i, j, k, m, n, n1, n2, halo, i_off, j_off, k_off
2679 if (
present(scale_factor)) scale = scale_factor
2680 sc_prev = 1.0_r8_kind
2681 if (
present(scale_prev)) sc_prev = scale_prev
2683 if (
present(bc_index))
then
2684 if (bc_index > var_in%num_bcs)&
2685 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: bc_index is present and exceeds var_in%num_bcs.")
2686 if(
associated(var_in%bc))
then
2687 if (
present(field_index))
then ;
if (field_index > var_in%bc(bc_index)%num_fields)&
2688 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: field_index is present and exceeds num_fields for" //&
2689 & trim(var_in%bc(bc_index)%name) )
2691 else if(
associated(var_in%bc_r4))
then
2692 if (
present(field_index))
then ;
if (field_index > var_in%bc_r4(bc_index)%num_fields)&
2693 &
call mpp_error(fatal,
"CT_increment_data_3d_3d: field_index is present and exceeds num_fields for" //&
2694 & trim(var_in%bc_r4(bc_index)%name) )
2697 elseif (
present(field_index))
then
2698 call mpp_error(fatal,
"CT_increment_data_3d_3d: bc_index must be present if field_index is present.")
2702 if (
present(halo_size)) halo = halo_size
2706 if (
present(bc_index))
then
2713 if ((var_in%iec-var_in%isc) /= (var%iec-var%isc))&
2714 &
call mpp_error(fatal,
"CT_increment_data_3d: There is an i-direction computational domain size mismatch.")
2715 if ((var_in%jec-var_in%jsc) /= (var%jec-var%jsc))&
2716 &
call mpp_error(fatal,
"CT_increment_data_3d: There is a j-direction computational domain size mismatch.")
2717 if ((var_in%ke-var_in%ks) /= (var%ke-var%ks))&
2718 &
call mpp_error(fatal,
"CT_increment_data_3d: There is a k-direction computational domain size mismatch.")
2719 if ((var_in%isc-var_in%isd < halo) .or. (var_in%ied-var_in%iec < halo))&
2720 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive i-direction halo size for the input structure.")
2721 if ((var_in%jsc-var_in%jsd < halo) .or. (var_in%jed-var_in%jec < halo))&
2722 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive j-direction halo size for the input structure.")
2723 if ((var%isc-var%isd < halo) .or. (var%ied-var%iec < halo))&
2724 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive i-direction halo size for the output structure.")
2725 if ((var%jsc-var%jsd < halo) .or. (var%jed-var%jec < halo))&
2726 &
call mpp_error(fatal,
"CT_increment_data_3d: Excessive j-direction halo size for the output structure.")
2728 i_off = var_in%isc - var%isc
2729 j_off = var_in%jsc - var%jsc
2730 k_off = var_in%ks - var%ks
2734 if(var_in%set .and. var_in%num_bcs .gt. 0)
then
2735 if(
associated(var_in%bc) .eqv.
associated(var_in%bc_r4))
then
2736 if(
associated(var_in%bc) )
then
2737 call mpp_error(fatal,
"CT_increment_data_3d_3d: var_in%bc and var_in%bc_r4 are both initialized,"//&
2738 "only one should be associated per type")
2740 call mpp_error(fatal,
"CT_increment_data_3d_3d: var_in%bc and var_in%bc_r4 are both uninitialized,"//&
2741 " only one must be associated per type to increment field data.")
2747 if(
associated(var_in%bc) .or. var_in%num_bcs .lt. 1)
then
2749 increment_bc = .true.
2750 if (increment_bc .and.
present(exclude_flux_type))&
2751 & increment_bc = .not.(trim(var%bc(n)%flux_type) == trim(exclude_flux_type))
2752 if (increment_bc .and.
present(only_flux_type))&
2753 & increment_bc = (trim(var%bc(n)%flux_type) == trim(only_flux_type))
2754 if (increment_bc .and.
present(pass_through_ice))&
2755 & increment_bc = (pass_through_ice .eqv. var%bc(n)%pass_through_ice)
2756 if (.not.increment_bc) cycle
2758 do m = 1, var_in%bc(n)%num_fields
2759 if (
present(field_index))
then
2760 if (m /= field_index) cycle
2762 if (
associated(var%bc(n)%field(m)%values) )
then
2764 do j=var%jsc-halo,var%jec+halo
2765 do i=var%isc-halo,var%iec+halo
2766 var%bc(n)%field(m)%values(i,j,k) = sc_prev * var%bc(n)%field(m)%values(i,j,k) +&
2767 & scale * var_in%bc(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
2774 else if(
associated(var_in%bc_r4))
then
2776 increment_bc = .true.
2777 if (increment_bc .and.
present(exclude_flux_type))&
2778 & increment_bc = .not.(trim(var%bc_r4(n)%flux_type) == trim(exclude_flux_type))
2779 if (increment_bc .and.
present(only_flux_type))&
2780 & increment_bc = (trim(var%bc_r4(n)%flux_type) == trim(only_flux_type))
2781 if (increment_bc .and.
present(pass_through_ice))&
2782 & increment_bc = (pass_through_ice .eqv. var%bc_r4(n)%pass_through_ice)
2783 if (.not.increment_bc) cycle
2785 do m = 1, var_in%bc_r4(n)%num_fields
2786 if (
present(field_index))
then
2787 if (m /= field_index) cycle
2789 if (
associated(var%bc_r4(n)%field(m)%values) )
then
2791 do j=var%jsc-halo,var%jec+halo
2792 do i=var%isc-halo,var%iec+halo
2793 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) +&
2794 & real(scale,r4_kind) * var_in%bc_r4(n)%field(m)%values(i+i_off,j+j_off,k+k_off)
2802 call mpp_error(fatal,
"CT_increment_data_3d_3d: passed in type has unassociated coupler_field_type"// &
2803 " pointers for both bc and bc_r4")
2812 character(len=*),
intent(in) :: diag_name
2814 integer,
dimension(:),
intent(in) :: axes
2819 if (diag_name ==
' ')
return
2821 if (
size(axes) < 2)
then
2822 call mpp_error(fatal,
'==>Error from coupler_types_mod' //&
2823 &
'(coupler_types_set_diags_3d): axes has less than 2 elements')
2826 if(var%set .and. var%num_bcs .gt. 0)
then
2827 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2828 if(
associated(var%bc) )
then
2829 call mpp_error(fatal,
"CT_set_diags_2d: var%bc and var%bc_r4 are both initialized,"//&
2830 "only one should be associated per type")
2832 call mpp_error(fatal,
"CT_set_diags_2d: var%bc and var%bc_r4 are both initialized,"//&
2833 "one should be associated per type to register fields with diag manager")
2839 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2840 do n = 1, var%num_bcs
2841 do m = 1, var%bc(n)%num_fields
2843 & var%bc(n)%field(m)%name, axes(1:2), time,&
2844 & var%bc(n)%field(m)%long_name, var%bc(n)%field(m)%units)
2847 else if(
associated(var%bc_r4))
then
2848 do n = 1, var%num_bcs
2849 do m = 1, var%bc_r4(n)%num_fields
2851 & var%bc_r4(n)%field(m)%name, axes(1:2), time,&
2852 & var%bc_r4(n)%field(m)%long_name, var%bc_r4(n)%field(m)%units)
2856 call mpp_error(fatal,
"CT_set_diags_2d: passed in type has unassociated coupler_field_type"// &
2857 " pointers for both bc and bc_r4")
2868 character(len=*),
intent(in) :: diag_name
2870 integer,
dimension(:),
intent(in) :: axes
2875 if (diag_name ==
' ')
return
2877 if (
size(axes) < 3)
then
2878 call mpp_error(fatal,
'==>Error from coupler_types_mod' //&
2879 &
'(coupler_types_set_diags_3d): axes has less than 3 elements')
2882 if(var%set .and. var%num_bcs .gt. 0)
then
2883 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2884 if(
associated(var%bc) )
then
2885 call mpp_error(fatal,
"CT_set_diags_3d: var%bc and var%bc_r4 are both initialized,"//&
2886 "only one should be associated per type")
2888 call mpp_error(fatal,
"CT_set_diags_3d: var%bc and var%bc_r4 are both uninitialized,"//&
2889 "one should be associated per type to register fields with diag manager")
2895 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2896 do n = 1, var%num_bcs
2897 do m = 1, var%bc(n)%num_fields
2899 & var%bc(n)%field(m)%name, axes(1:3), time,&
2900 & var%bc(n)%field(m)%long_name, var%bc(n)%field(m)%units )
2903 else if(
associated(var%bc_r4))
then
2904 do n = 1, var%num_bcs
2905 do m = 1, var%bc_r4(n)%num_fields
2907 & var%bc_r4(n)%field(m)%name, axes(1:3), time,&
2908 & var%bc_r4(n)%field(m)%long_name, var%bc_r4(n)%field(m)%units )
2912 call mpp_error(fatal,
"CT_set_diags_3d: passed in type has unassociated coupler_field_type"// &
2913 " pointers for both bc and bc_r4")
2922 logical,
allocatable,
optional,
intent(out) :: return_statuses(:,:)
2929 if(var%set .and. var%num_bcs .gt. 0)
then
2930 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2931 if(
associated(var%bc) )
then
2932 call mpp_error(fatal,
"CT_send_data_2d: var%bc and var%bc_r4 are both initialized,"//&
2933 "only one should be associated per type")
2935 call mpp_error(fatal,
"CT_send_data_2d: var%bc and var%bc_r4 are both uninitialized,"//&
2936 "one should be associated per type to send data to diag fields")
2942 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
2945 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
2946 allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
2949 do n = 1, var%num_bcs
2950 do m = 1, var%bc(n)%num_fields
2951 if (var%bc(n)%field(m)%id_diag > 0)
then
2952 used =
send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, time)
2953 if(
allocated(return_statuses)) return_statuses(n,m) = used
2958 else if(
associated(var%bc_r4))
then
2961 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
2962 allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
2965 do n = 1, var%num_bcs
2966 do m = 1, var%bc_r4(n)%num_fields
2967 if (var%bc_r4(n)%field(m)%id_diag > 0)
then
2968 used =
send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, time)
2969 if(
allocated(return_statuses)) return_statuses(n,m) = used
2974 call mpp_error(fatal,
"CT_send_data_2d: passed in type has unassociated coupler_field_type"// &
2975 " pointers for both bc and bc_r4")
2983 logical,
allocatable,
optional,
intent(out) :: return_statuses(:,:)
2990 if(var%set .and. var%num_bcs .gt. 0)
then
2991 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
2992 if(
associated(var%bc) )
then
2993 call mpp_error(fatal,
"CT_send_data_3d: var%bc and var%bc_r4 are both initialized,"//&
2994 "only one should be associated per type")
2996 call mpp_error(fatal,
"CT_send_data_3d: var%bc and var%bc_r4 are both uninitialized,"//&
2997 "one should be associated per type to send data to diag fields")
3003 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3006 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
3007 allocate(return_statuses(var%num_bcs, var%bc(1)%num_fields))
3010 do n = 1, var%num_bcs
3011 do m = 1, var%bc(n)%num_fields
3012 if (var%bc(n)%field(m)%id_diag > 0)
then
3013 used =
send_data(var%bc(n)%field(m)%id_diag, var%bc(n)%field(m)%values, time)
3014 if(
allocated(return_statuses)) return_statuses(n,m) = used
3018 else if(
associated(var%bc_r4))
then
3021 if(
present(return_statuses) .and. var%num_bcs .gt. 0)
then
3022 allocate(return_statuses(var%num_bcs, var%bc_r4(1)%num_fields))
3025 do n = 1, var%num_bcs
3026 do m = 1, var%bc_r4(n)%num_fields
3027 if (var%bc_r4(n)%field(m)%id_diag > 0)
then
3028 used =
send_data(var%bc_r4(n)%field(m)%id_diag, var%bc_r4(n)%field(m)%values, time)
3029 if(
allocated(return_statuses)) return_statuses(n,m) = used
3034 call mpp_error(fatal,
"CT_send_data_3d: passed in type has unassociated coupler_field_type"// &
3035 " pointers for both bc and bc_r4")
3044 type(fmsnetcdfdomainfile_t),
dimension(:),
pointer :: bc_rest_files
3045 integer,
intent(out) :: num_rest_files
3046 type(
domain2d),
intent(in) :: mpp_domain
3047 logical,
intent(in) :: to_read
3048 logical,
optional,
intent(in) :: ocean_restart
3049 character(len=*),
optional,
intent(in) :: directory
3051 character(len=FMS_FILE_LEN),
dimension(max(1,var%num_bcs)) :: rest_file_names
3052 character(len=FMS_FILE_LEN) :: file_nm
3056 character(len=20),
allocatable,
dimension(:) :: dim_names
3057 character(len=20) :: io_type
3058 logical,
dimension(max(1,var%num_bcs)) :: file_is_open
3059 character(len=FMS_PATH_LEN) :: dir
3061 if(var%set .and. var%num_bcs .gt. 0)
then
3062 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3063 if(
associated(var%bc) )
then
3064 call mpp_error(fatal,
"CT_register_restarts_2d: var%bc and var%bc_r4 are both initialized,"//&
3065 "only one should be associated per type")
3067 call mpp_error(fatal,
"CT_register_restarts_2d: var%bc and var%bc_r4 are both uninitialized,"//&
3068 "one should be associated per type to register restart fields")
3074 if (
present(ocean_restart)) ocn_rest = ocean_restart
3076 if (
present(directory)) dir = trim(directory)
3080 if (.not.
present(directory)) dir =
"INPUT/"
3082 io_type =
"overwrite"
3083 if (.not.
present(directory)) dir =
"RESTART/"
3088 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3090 do n = 1, var%num_bcs
3091 if (var%bc(n)%num_fields <= 0) cycle
3092 file_nm = trim(var%bc(n)%ice_restart_file)
3093 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3094 do f = 1, num_rest_files
3095 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3097 if (f>num_rest_files)
then
3098 num_rest_files = num_rest_files + 1
3099 rest_file_names(f) = trim(file_nm)
3103 if (num_rest_files == 0)
return
3105 allocate(bc_rest_files(num_rest_files))
3108 do n = 1, num_rest_files
3109 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3110 & is_restart=.true.)
3111 if (file_is_open(n))
then
3117 do n = 1, var%num_bcs
3118 if (var%bc(n)%num_fields <= 0) cycle
3120 file_nm = trim(var%bc(n)%ice_restart_file)
3121 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3122 do f = 1, num_rest_files
3123 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3126 var%bc(n)%fms2_io_rest_type => bc_rest_files(f)
3128 do m = 1, var%bc(n)%num_fields
3129 if (file_is_open(f))
then
3130 if( to_read .and. variable_exists(bc_rest_files(f), var%bc(n)%field(m)%name))
then
3132 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc(n)%field(m)%name)))
3133 call get_variable_dimension_names(bc_rest_files(f), &
3134 & var%bc(n)%field(m)%name, dim_names)
3137 allocate(dim_names(3))
3138 dim_names(1) =
"xaxis_1"
3139 dim_names(2) =
"yaxis_1"
3140 dim_names(3) =
"Time"
3144 & var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, dim_names, &
3145 & is_optional=var%bc(n)%field(m)%may_init )
3147 deallocate(dim_names)
3151 else if(
associated(var%bc_r4))
then
3153 do n = 1, var%num_bcs
3154 if (var%bc_r4(n)%num_fields <= 0) cycle
3155 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3156 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3157 do f = 1, num_rest_files
3158 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3160 if (f>num_rest_files)
then
3161 num_rest_files = num_rest_files + 1
3162 rest_file_names(f) = trim(file_nm)
3166 if (num_rest_files == 0)
return
3168 allocate(bc_rest_files(num_rest_files))
3171 do n = 1, num_rest_files
3172 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3173 & is_restart=.true.)
3174 if (file_is_open(n))
then
3180 do n = 1, var%num_bcs
3181 if (var%bc_r4(n)%num_fields <= 0) cycle
3183 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3184 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3185 do f = 1, num_rest_files
3186 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3189 var%bc_r4(n)%fms2_io_rest_type => bc_rest_files(f)
3191 do m = 1, var%bc_r4(n)%num_fields
3192 if (file_is_open(f))
then
3193 if( to_read .and. variable_exists(bc_rest_files(f), var%bc_r4(n)%field(m)%name))
then
3195 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc_r4(n)%field(m)%name)))
3196 call get_variable_dimension_names(bc_rest_files(f), &
3197 & var%bc_r4(n)%field(m)%name, dim_names)
3200 allocate(dim_names(3))
3201 dim_names(1) =
"xaxis_1"
3202 dim_names(2) =
"yaxis_1"
3203 dim_names(3) =
"Time"
3207 & var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, dim_names, &
3208 & is_optional=var%bc_r4(n)%field(m)%may_init )
3210 deallocate(dim_names)
3215 call mpp_error(fatal,
"CT_register_restarts_2d: passed in type has unassociated coupler_field_type"// &
3216 " pointers for both bc and bc_r4")
3223 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3225 character(len=20),
dimension(:),
allocatable :: file_dim_names
3229 logical :: is_domain_decomposed
3230 character(len=1) :: buffer
3232 ndims = get_num_dimensions(fileobj)
3233 allocate(file_dim_names(ndims))
3235 call get_dimension_names(fileobj, file_dim_names)
3238 is_domain_decomposed = .false.
3241 if (variable_exists(fileobj, file_dim_names(i)))
then
3244 if (variable_att_exists(fileobj, file_dim_names(i),
"axis"))
then
3245 call get_variable_attribute(fileobj, file_dim_names(i),
"axis", buffer)
3248 if (lowercase(buffer) .eq.
"x" .or. lowercase(buffer) .eq.
"y" )
then
3249 is_domain_decomposed = .true.
3253 else if (variable_att_exists(fileobj, file_dim_names(i),
"cartesian_axis"))
then
3254 call get_variable_attribute(fileobj, file_dim_names(i),
"cartesian_axis", buffer)
3257 if (lowercase(buffer) .eq.
"x" .or. lowercase(buffer) .eq.
"y" )
then
3258 is_domain_decomposed = .true.
3265 if (.not. is_domain_decomposed)
then
3266 call get_dimension_size(fileobj, file_dim_names(i), dim_size)
3276 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3277 integer,
intent(in),
optional :: nz
3279 character(len=20) :: dim_names(4)
3281 dim_names(1) =
"xaxis_1"
3282 dim_names(2) =
"yaxis_1"
3288 if (.not.
present(nz))
then
3289 dim_names(3) =
"Time"
3292 dim_names(3) =
"zaxis_1"
3293 dim_names(4) =
"Time"
3300 call register_field(fileobj, dim_names(1),
"double", (/dim_names(1)/))
3301 call register_variable_attribute(fileobj, dim_names(1),
"axis",
"X", str_len=1)
3303 call register_field(fileobj, dim_names(2),
"double", (/dim_names(2)/))
3304 call register_variable_attribute(fileobj, dim_names(2),
"axis",
"Y", str_len=1)
3309 type(fmsnetcdfdomainfile_t),
intent(inout) :: fileobj
3310 logical,
intent(in) :: to_read
3311 integer,
intent(in),
optional :: nz
3326 type(fmsnetcdfdomainfile_t),
dimension(:),
pointer :: bc_rest_files
3327 integer,
intent(out) :: num_rest_files
3328 type(
domain2d),
intent(in) :: mpp_domain
3329 logical,
intent(in) :: to_read
3330 logical,
optional,
intent(in) :: ocean_restart
3331 character(len=*),
optional,
intent(in) :: directory
3333 character(len=FMS_FILE_LEN),
dimension(max(1,var%num_bcs)) :: rest_file_names
3334 character(len=FMS_FILE_LEN) :: file_nm
3338 character(len=20),
allocatable,
dimension(:) :: dim_names
3339 character(len=20) :: io_type
3340 logical,
dimension(max(1,var%num_bcs)) :: file_is_open
3341 character(len=FMS_PATH_LEN) :: dir
3344 if(var%set .and. var%num_bcs .gt. 0)
then
3345 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3346 if(
associated(var%bc) )
then
3347 call mpp_error(fatal,
"CT_register_restarts_3d: var%bc and var%bc_r4 are both initialized,"//&
3348 "only one should be associated per type")
3350 call mpp_error(fatal,
"CT_register_restarts_3d: var%bc and var%bc_r4 are both uninitialized,"//&
3351 "one should be associated per type to register restart fields")
3357 if (
present(ocean_restart)) ocn_rest = ocean_restart
3359 if (
present(directory)) dir = trim(directory)
3363 if (.not.
present(directory)) dir =
"INPUT/"
3365 io_type =
"overwrite"
3366 if (.not.
present(directory)) dir =
"RESTART/"
3369 nz = var%ke - var%ks + 1
3372 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3374 do n = 1, var%num_bcs
3375 if (var%bc(n)%num_fields <= 0) cycle
3376 file_nm = trim(var%bc(n)%ice_restart_file)
3377 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3378 do f = 1, num_rest_files
3379 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3381 if (f>num_rest_files)
then
3382 num_rest_files = num_rest_files + 1
3383 rest_file_names(f) = trim(file_nm)
3387 if (num_rest_files == 0)
return
3389 allocate(bc_rest_files(num_rest_files))
3392 do n = 1, num_rest_files
3393 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3394 & is_restart=.true.)
3395 if (file_is_open(n))
then
3406 do n = 1, var%num_bcs
3407 if (var%bc(n)%num_fields <= 0) cycle
3409 file_nm = trim(var%bc(n)%ice_restart_file)
3410 if (ocn_rest) file_nm = trim(var%bc(n)%ocean_restart_file)
3411 do f = 1, num_rest_files
3412 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3415 var%bc(n)%fms2_io_rest_type => bc_rest_files(f)
3417 do m = 1, var%bc(n)%num_fields
3418 if (file_is_open(f))
then
3419 if( to_read .and. variable_exists(bc_rest_files(f), var%bc(n)%field(m)%name))
then
3421 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc(n)%field(m)%name)))
3422 call get_variable_dimension_names(bc_rest_files(f), &
3423 & var%bc(n)%field(m)%name, dim_names)
3426 allocate(dim_names(4))
3427 dim_names(1) =
"xaxis_1"
3428 dim_names(2) =
"yaxis_1"
3429 dim_names(3) =
"zaxis_1"
3430 dim_names(4) =
"Time"
3434 & var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, dim_names, &
3435 & is_optional=var%bc(n)%field(m)%may_init )
3436 deallocate(dim_names)
3440 else if(
associated(var%bc_r4))
then
3442 do n = 1, var%num_bcs
3443 if (var%bc_r4(n)%num_fields <= 0) cycle
3444 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3445 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3446 do f = 1, num_rest_files
3447 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3449 if (f>num_rest_files)
then
3450 num_rest_files = num_rest_files + 1
3451 rest_file_names(f) = trim(file_nm)
3455 if (num_rest_files == 0)
return
3457 allocate(bc_rest_files(num_rest_files))
3460 do n = 1, num_rest_files
3461 file_is_open(n) =
open_file(bc_rest_files(n), trim(dir)//rest_file_names(n), io_type, mpp_domain, &
3462 & is_restart=.true.)
3463 if (file_is_open(n))
then
3474 do n = 1, var%num_bcs
3475 if (var%bc_r4(n)%num_fields <= 0) cycle
3477 file_nm = trim(var%bc_r4(n)%ice_restart_file)
3478 if (ocn_rest) file_nm = trim(var%bc_r4(n)%ocean_restart_file)
3479 do f = 1, num_rest_files
3480 if (trim(file_nm) == trim(rest_file_names(f)))
exit
3483 var%bc_r4(n)%fms2_io_rest_type => bc_rest_files(f)
3485 do m = 1, var%bc_r4(n)%num_fields
3486 if (file_is_open(f))
then
3487 if( to_read .and. variable_exists(bc_rest_files(f), var%bc_r4(n)%field(m)%name))
then
3489 allocate(dim_names(get_variable_num_dimensions(bc_rest_files(f), var%bc_r4(n)%field(m)%name)))
3490 call get_variable_dimension_names(bc_rest_files(f), &
3491 & var%bc_r4(n)%field(m)%name, dim_names)
3494 allocate(dim_names(4))
3495 dim_names(1) =
"xaxis_1"
3496 dim_names(2) =
"yaxis_1"
3497 dim_names(3) =
"zaxis_1"
3498 dim_names(4) =
"Time"
3502 & var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, dim_names, &
3503 & is_optional=var%bc_r4(n)%field(m)%may_init )
3504 deallocate(dim_names)
3509 call mpp_error(fatal,
"CT_register_restarts_2d: passed in type has unassociated coupler_field_type"// &
3510 " pointers for both bc and bc_r4")
3516 character(len=*),
optional,
intent(in) :: directory
3518 logical,
optional,
intent(in) :: all_or_nothing
3521 logical,
optional,
intent(in) :: all_required
3524 logical,
optional,
intent(in) :: test_by_field
3526 logical,
intent(in) :: use_fms2_io
3528 integer :: n, m, num_fld
3529 character(len=80) :: unset_varname
3530 logical :: any_set, all_set, all_var_set, any_var_set, var_set
3532 if(var%set .and. var%num_bcs .gt. 0)
then
3533 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3534 if(
associated(var%bc) )
then
3535 call mpp_error(fatal,
"CT_restore_state_2d: var%bc and var%bc_r4 are both initialized," // &
3536 "only one should be associated per type")
3538 call mpp_error(fatal,
"CT_restore_state_2d: var%bc and var%bc_r4 are both uninitialized," // &
3539 "one should be associated per type to restore state from restart")
3549 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3550 do n = 1, var%num_bcs
3551 any_var_set = .false.
3552 all_var_set = .true.
3553 do m = 1, var%bc(n)%num_fields
3555 if (check_if_open(var%bc(n)%fms2_io_rest_type))
then
3556 var_set = variable_exists(var%bc(n)%fms2_io_rest_type, var%bc(n)%field(m)%name)
3559 if (.not.var_set) unset_varname = trim(var%bc(n)%field(m)%name)
3560 if (var_set) any_set = .true.
3561 if (all_set) all_set = var_set
3562 if (var_set) any_var_set = .true.
3563 if (all_var_set) all_var_set = var_set
3566 num_fld = num_fld + var%bc(n)%num_fields
3567 if ((var%bc(n)%num_fields > 0) .and.
present(test_by_field))
then
3568 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3569 &
"CT_restore_state_2d: test_by_field is true, and "//&
3570 & trim(unset_varname)//
" was not read but some other fields in "//&
3571 & trim(trim(var%bc(n)%name))//
" were.")
3574 else if(
associated(var%bc_r4))
then
3575 do n = 1, var%num_bcs
3576 any_var_set = .false.
3577 all_var_set = .true.
3578 do m = 1, var%bc_r4(n)%num_fields
3580 if (check_if_open(var%bc_r4(n)%fms2_io_rest_type))
then
3581 var_set = variable_exists(var%bc_r4(n)%fms2_io_rest_type, var%bc_r4(n)%field(m)%name)
3584 if (.not.var_set) unset_varname = trim(var%bc_r4(n)%field(m)%name)
3585 if (var_set) any_set = .true.
3586 if (all_set) all_set = var_set
3587 if (var_set) any_var_set = .true.
3588 if (all_var_set) all_var_set = var_set
3591 num_fld = num_fld + var%bc_r4(n)%num_fields
3592 if ((var%bc_r4(n)%num_fields > 0) .and.
present(test_by_field))
then
3593 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3594 &
"CT_restore_state_2d: test_by_field is true, and "//&
3595 & trim(unset_varname)//
" was not read but some other fields in "//&
3596 & trim(trim(var%bc_r4(n)%name))//
" were.")
3600 call mpp_error(fatal,
"CT_restore_state_2d: passed in type has unassociated coupler_field_type"// &
3601 " pointers for both bc and bc_r4")
3604 if ((num_fld > 0) .and.
present(all_or_nothing))
then
3605 if (all_or_nothing .and. (all_set .neqv. any_set))
call mpp_error(fatal,&
3606 &
"CT_restore_state_2d: all_or_nothing is true, and "//&
3607 & trim(unset_varname)//
" was not read but some other fields were.")
3610 if (
present(all_required))
then
3611 if (all_required .and. .not.all_set)
then
3612 call mpp_error(fatal,
"CT_restore_state_2d: all_required is true, but "//&
3613 & trim(unset_varname)//
" was not read from its restart file.")
3624 character(len=*),
optional,
intent(in) :: directory
3626 logical,
intent(in) :: use_fms2_io
3627 logical,
optional,
intent(in) :: all_or_nothing
3630 logical,
optional,
intent(in) :: all_required
3633 logical,
optional,
intent(in) :: test_by_field
3636 integer :: n, m, num_fld
3637 character(len=80) :: unset_varname
3638 logical :: any_set, all_set, all_var_set, any_var_set, var_set
3640 if(var%set .and. var%num_bcs .gt. 0)
then
3641 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3642 if(
associated(var%bc) )
then
3643 call mpp_error(fatal,
"CT_restore_state_3d: var%bc and var%bc_r4 are both initialized," // &
3644 "only one should be associated per type")
3646 call mpp_error(fatal,
"CT_restore_state_3d: var%bc and var%bc_r4 are both uninitialized," // &
3647 "one should be associated per type to restore state from restart")
3657 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3658 do n = 1, var%num_bcs
3659 any_var_set = .false.
3660 all_var_set = .true.
3661 do m = 1, var%bc(n)%num_fields
3663 if (check_if_open(var%bc(n)%fms2_io_rest_type))
then
3664 var_set = variable_exists(var%bc(n)%fms2_io_rest_type, var%bc(n)%field(m)%name)
3667 if (.not.var_set) unset_varname = trim(var%bc(n)%field(m)%name)
3669 if (var_set) any_set = .true.
3670 if (all_set) all_set = var_set
3671 if (var_set) any_var_set = .true.
3672 if (all_var_set) all_var_set = var_set
3675 num_fld = num_fld + var%bc(n)%num_fields
3676 if ((var%bc(n)%num_fields > 0) .and.
present(test_by_field))
then
3677 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3678 &
"CT_restore_state_3d: test_by_field is true, and "//&
3679 & trim(unset_varname)//
" was not read but some other fields in "//&
3680 & trim(trim(var%bc(n)%name))//
" were.")
3683 else if(
associated(var%bc_r4))
then
3684 do n = 1, var%num_bcs
3685 any_var_set = .false.
3686 all_var_set = .true.
3687 do m = 1, var%bc_r4(n)%num_fields
3689 if (check_if_open(var%bc_r4(n)%fms2_io_rest_type))
then
3690 var_set = variable_exists(var%bc_r4(n)%fms2_io_rest_type, var%bc_r4(n)%field(m)%name)
3693 if (.not.var_set) unset_varname = trim(var%bc_r4(n)%field(m)%name)
3695 if (var_set) any_set = .true.
3696 if (all_set) all_set = var_set
3697 if (var_set) any_var_set = .true.
3698 if (all_var_set) all_var_set = var_set
3701 num_fld = num_fld + var%bc_r4(n)%num_fields
3702 if ((var%bc_r4(n)%num_fields > 0) .and.
present(test_by_field))
then
3703 if (test_by_field .and. (all_var_set .neqv. any_var_set))
call mpp_error(fatal,&
3704 &
"CT_restore_state_3d: test_by_field is true, and "//&
3705 & trim(unset_varname)//
" was not read but some other fields in "//&
3706 & trim(trim(var%bc(n)%name))//
" were.")
3710 call mpp_error(fatal,
"CT_restore_state_3d: passed in type has unassociated coupler_field_type"// &
3711 " pointers for both bc and bc_r4")
3715 if ((num_fld > 0) .and.
present(all_or_nothing))
then
3716 if (all_or_nothing .and. (all_set .neqv. any_set))
call mpp_error(fatal,&
3717 &
"CT_restore_state_3d: all_or_nothing is true, and "//&
3718 & trim(unset_varname)//
" was not read but some other fields were.")
3721 if (
present(all_required))
then
3722 if (all_required .and. .not.all_set)
then
3723 call mpp_error(fatal,
"CT_restore_state_3d: all_required is true, but "//&
3724 & trim(unset_varname)//
" was not read from its restart file.")
3732 character(len=3),
intent(in) :: gridname
3737 if(var%set .and. var%num_bcs .gt. 0)
then
3738 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3739 if(
associated(var%bc) )
then
3740 call mpp_error(fatal,
"CT_data_override_2d: var%bc and var%bc_r4 are both initialized," // &
3741 "only one should be associated per type")
3743 call mpp_error(fatal,
"CT_data_override_2d: var%bc and var%bc_r4 are both uninitialized," // &
3744 "one should be associated per type to perform data override")
3749 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3750 do n = 1, var%num_bcs
3751 do m = 1, var%bc(n)%num_fields
3752 call data_override(gridname, var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, time)
3755 else if(
associated(var%bc_r4))
then
3756 do n = 1, var%num_bcs
3757 do m = 1, var%bc_r4(n)%num_fields
3758 call data_override(gridname, var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, time)
3762 call mpp_error(fatal,
"CT_data_override_2d: passed in type has unassociated coupler_field_type"// &
3763 " pointers for both bc and bc_r4")
3769 character(len=3),
intent(in) :: gridname
3773 real(r8_kind),
allocatable :: r8_field_values(:,:,:)
3777 if(var%set .and. var%num_bcs .gt. 0)
then
3778 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3779 if(
associated(var%bc) )
then
3780 call mpp_error(fatal,
"CT_data_override_3d: var%bc and var%bc_r4 are both initialized," // &
3781 "only one should be associated per type")
3783 call mpp_error(fatal,
"CT_data_override_3d: var%bc and var%bc_r4 are both uninitialized," // &
3784 "one should be associated per type to perform data override")
3789 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3790 do n = 1, var%num_bcs
3791 do m = 1, var%bc(n)%num_fields
3792 call data_override(gridname, var%bc(n)%field(m)%name, var%bc(n)%field(m)%values, time)
3795 else if(
associated(var%bc_r4))
then
3796 do n = 1, var%num_bcs
3797 do m = 1, var%bc_r4(n)%num_fields
3798 call data_override(gridname, var%bc_r4(n)%field(m)%name, var%bc_r4(n)%field(m)%values, time)
3802 call mpp_error(fatal,
"CT_data_override_3d: passed in type has unassociated coupler_field_type"// &
3803 " pointers for both bc and bc_r4")
3812 integer,
intent(in) :: outunit
3813 character(len=*),
optional,
intent(in) :: name_lead
3815 character(len=120) :: var_name
3817 integer(i8_kind) :: chks
3819 if(var%set .and. var%num_bcs .gt. 0)
then
3820 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3821 if(
associated(var%bc) )
then
3822 call mpp_error(fatal,
"CT_write_chksums_2d: var%bc and var%bc_r4 are both initialized," // &
3823 "only one should be associated per type")
3825 call mpp_error(fatal,
"CT_write_chksums_2d: var%bc and var%bc_r4 are both uninitialized," // &
3826 "one should be associated per type to write checksums for fields")
3831 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3832 do n = 1, var%num_bcs
3833 do m = 1, var%bc(n)%num_fields
3834 if (
present(name_lead))
then
3835 var_name = trim(name_lead)//trim(var%bc(n)%field(m)%name)
3837 var_name = trim(var%bc(n)%field(m)%name)
3839 chks =
mpp_chksum(var%bc(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec))
3840 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3843 else if(
associated(var%bc_r4))
then
3844 do n = 1, var%num_bcs
3845 do m = 1, var%bc_r4(n)%num_fields
3846 if (
present(name_lead))
then
3847 var_name = trim(name_lead)//trim(var%bc_r4(n)%field(m)%name)
3849 var_name = trim(var%bc_r4(n)%field(m)%name)
3851 chks =
mpp_chksum(var%bc_r4(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec))
3852 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3856 call mpp_error(fatal,
"CT_write_chksums_2d: passed in type has unassociated coupler_field_type"// &
3857 " pointers for both bc and bc_r4")
3864 integer,
intent(in) :: outunit
3865 character(len=*),
optional,
intent(in) :: name_lead
3867 character(len=120) :: var_name
3869 integer(i8_kind) :: chks
3871 if(var%set .and. var%num_bcs .gt. 0)
then
3872 if(
associated(var%bc) .eqv.
associated(var%bc_r4))
then
3873 if(
associated(var%bc) )
then
3874 call mpp_error(fatal,
"CT_write_chksums_3d: var%bc and var%bc_r4 are both initialized," // &
3875 "only one should be associated per type")
3877 call mpp_error(fatal,
"CT_write_chksums_3d: var%bc and var%bc_r4 are both uninitialized," // &
3878 "one should be associated per type to write checksums for fields")
3883 if(
associated(var%bc) .or. var%num_bcs .lt. 1)
then
3884 do n = 1, var%num_bcs
3885 do m = 1, var%bc(n)%num_fields
3886 if (
present(name_lead))
then
3887 var_name = trim(name_lead)//trim(var%bc(n)%field(m)%name)
3889 var_name = trim(var%bc(n)%field(m)%name)
3891 chks =
mpp_chksum(var%bc(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec,:))
3892 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3895 else if(
associated(var%bc_r4))
then
3896 do n = 1, var%num_bcs
3897 do m = 1, var%bc_r4(n)%num_fields
3898 if (
present(name_lead))
then
3899 var_name = trim(name_lead)//trim(var%bc_r4(n)%field(m)%name)
3901 var_name = trim(var%bc_r4(n)%field(m)%name)
3903 chks =
mpp_chksum(var%bc_r4(n)%field(m)%values(var%isc:var%iec,var%jsc:var%jec,:))
3904 if(outunit.ne.0)
write(outunit,
'(" CHECKSUM:: ",A40," = ",Z20)') trim(var_name), chks
3908 call mpp_error(fatal,
"CT_write_chksums_2d: passed in type has unassociated coupler_field_type"// &
3909 " pointers for both bc and bc_r4")
3944 if (var%num_bcs > 0)
then
3945 if(
associated(var%bc))
then
3946 do n = 1, var%num_bcs
3947 do m = 1, var%bc(n)%num_fields
3948 deallocate ( var%bc(n)%field(m)%values )
3950 deallocate ( var%bc(n)%field )
3952 deallocate ( var%bc )
3953 else if(
associated(var%bc_r4))
then
3954 do n = 1, var%num_bcs
3955 do m = 1, var%bc_r4(n)%num_fields
3956 deallocate ( var%bc_r4(n)%field(m)%values )
3958 deallocate ( var%bc_r4(n)%field )
3960 deallocate ( var%bc_r4 )
3962 call mpp_error(fatal,
"CT_destructor_1d: passed in type has unassociated coupler_field_type"// &
3963 " pointers for both bc and bc_r4")
3977 if (var%num_bcs > 0)
then
3978 if(
associated(var%bc))
then
3979 do n = 1, var%num_bcs
3980 do m = 1, var%bc(n)%num_fields
3981 deallocate ( var%bc(n)%field(m)%values )
3983 deallocate ( var%bc(n)%field )
3985 deallocate ( var%bc )
3986 else if(
associated(var%bc_r4))
then
3987 do n = 1, var%num_bcs
3988 do m = 1, var%bc_r4(n)%num_fields
3989 deallocate ( var%bc_r4(n)%field(m)%values )
3991 deallocate ( var%bc_r4(n)%field )
3993 deallocate ( var%bc_r4 )
3995 call mpp_error(fatal,
"CT_destructor_2d: passed in type has unassociated coupler_field_type"// &
3996 " pointers for both bc and bc_r4")
4010 if (var%num_bcs > 0)
then
4011 if(
associated(var%bc))
then
4012 do n = 1, var%num_bcs
4013 do m = 1, var%bc(n)%num_fields
4014 deallocate ( var%bc(n)%field(m)%values )
4016 deallocate ( var%bc(n)%field )
4018 deallocate ( var%bc )
4019 else if(
associated(var%bc_r4))
then
4020 do n = 1, var%num_bcs
4021 do m = 1, var%bc_r4(n)%num_fields
4022 deallocate ( var%bc_r4(n)%field(m)%values )
4024 deallocate ( var%bc_r4(n)%field )
4026 deallocate ( var%bc_r4 )
4028 call mpp_error(fatal,
"CT_destructor_3d: passed in type has unassociated coupler_field_type"// &
4029 " pointers for both bc and bc_r4")
4038 #include "coupler_types_r4.fh"
4039 #include "coupler_types_r8.fh"
4041 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.