28 implicit none ;
private 36 is, ie, js, je, conversion)
38 integer,
intent(in) :: BC_index, BC_element
39 real,
dimension(:,:),
intent(out) :: array_out
40 integer,
optional,
intent(in) :: is, ie, js, je
41 real,
optional,
intent(in) :: conversion
53 real,
pointer,
dimension(:,:) :: Array_in
55 integer :: i, j, is0, ie0, js0, je0, i_offset, j_offset
57 if ((bc_element /= ind_flux) .and. (bc_element /= ind_alpha) .and. &
59 call mom_error(fatal,
"extract_coupler_values: Unrecognized BC_element.")
64 if (.not.
associated(bc_struc%bc)) &
65 call mom_error(fatal,
"extract_coupler_values: " // &
66 "The requested boundary condition is not associated.")
68 if (.not.
associated(bc_struc%bc(bc_index)%field)) &
69 call mom_error(fatal,
"extract_coupler_values: " // &
70 "The requested boundary condition element is not associated.")
71 if (.not.
associated(bc_struc%bc(bc_index)%field(bc_element)%values)) &
72 call mom_error(fatal,
"extract_coupler_values: " // &
73 "The requested boundary condition value array is not associated.")
75 array_in => bc_struc%bc(bc_index)%field(bc_element)%values
77 if (
present(is))
then ; is0 = is ;
else ; is0 = lbound(array_out,1) ;
endif 78 if (
present(ie))
then ; ie0 = ie ;
else ; ie0 = ubound(array_out,1) ;
endif 79 if (
present(js))
then ; js0 = js ;
else ; js0 = lbound(array_out,2) ;
endif 80 if (
present(je))
then ; je0 = je ;
else ; je0 = ubound(array_out,2) ;
endif 82 conv = 1.0 ;
if (
present(conversion)) conv = conversion
84 if (
size(array_in,1) /= ie0 - is0 + 1) &
85 call mom_error(fatal,
"extract_coupler_values: Mismatch in i-size " // &
86 "between BC array and output array or computational domain.")
87 if (
size(array_in,2) /= je0 - js0 + 1) &
88 call mom_error(fatal,
"extract_coupler_values: Mismatch in i-size " // &
89 "between BC array and output array or computational domain.")
90 i_offset = lbound(array_in,1) - is0
91 j_offset = lbound(array_in,2) - js0
92 do j=js0,je0 ;
do i=is0,ie0
93 array_out(i,j) = conv * array_in(i+i_offset,j+j_offset)
99 is, ie, js, je, conversion)
100 real,
dimension(:,:),
intent(in) :: array_in
102 integer,
intent(in) :: BC_index, BC_element
103 integer,
optional,
intent(in) :: is, ie, js, je
104 real,
optional,
intent(in) :: conversion
116 real,
pointer,
dimension(:,:) :: Array_out
118 integer :: i, j, is0, ie0, js0, je0, i_offset, j_offset
120 if ((bc_element /= ind_flux) .and. (bc_element /= ind_alpha) .and. &
122 call mom_error(fatal,
"extract_coupler_values: Unrecognized BC_element.")
127 if (.not.
associated(bc_struc%bc)) &
128 call mom_error(fatal,
"set_coupler_values: " // &
129 "The requested boundary condition is not associated.")
131 if (.not.
associated(bc_struc%bc(bc_index)%field)) &
132 call mom_error(fatal,
"set_coupler_values: " // &
133 "The requested boundary condition element is not associated.")
134 if (.not.
associated(bc_struc%bc(bc_index)%field(bc_element)%values)) &
135 call mom_error(fatal,
"set_coupler_values: " // &
136 "The requested boundary condition value array is not associated.")
138 array_out => bc_struc%bc(bc_index)%field(bc_element)%values
140 if (
present(is))
then ; is0 = is ;
else ; is0 = lbound(array_in,1) ;
endif 141 if (
present(ie))
then ; ie0 = ie ;
else ; ie0 = ubound(array_in,1) ;
endif 142 if (
present(js))
then ; js0 = js ;
else ; js0 = lbound(array_in,2) ;
endif 143 if (
present(je))
then ; je0 = je ;
else ; je0 = ubound(array_in,2) ;
endif 145 conv = 1.0 ;
if (
present(conversion)) conv = conversion
147 if (
size(array_out,1) /= ie0 - is0 + 1) &
148 call mom_error(fatal,
"extract_coupler_values: Mismatch in i-size " // &
149 "between BC array and input array or computational domain.")
150 if (
size(array_out,2) /= je0 - js0 + 1) &
151 call mom_error(fatal,
"extract_coupler_values: Mismatch in i-size " // &
152 "between BC array and input array or computational domain.")
153 i_offset = lbound(array_out,1) - is0
154 j_offset = lbound(array_out,2) - js0
155 do j=js0,je0 ;
do i=is0,ie0
156 array_out(i+i_offset,j+j_offset) = conv * array_in(i,j)
integer, public ind_csurf
subroutine, public extract_coupler_values(BC_struc, BC_index, BC_element, array_out, is, ie, js, je, conversion)
integer, public ind_alpha
subroutine, public set_coupler_values(array_in, BC_struc, BC_index, BC_element, is, ie, js, je, conversion)
subroutine, public mom_error(level, message, all_print)