MOM6
coupler_util Module Reference

Functions/Subroutines

subroutine, public extract_coupler_values (BC_struc, BC_index, BC_element, array_out, is, ie, js, je, conversion)
 
subroutine, public set_coupler_values (array_in, BC_struc, BC_index, BC_element, is, ie, js, je, conversion)
 
subroutine, public extract_coupler_values (BC_struc, BC_index, BC_element, array_out, is, ie, js, je, conversion)
 

Function/Subroutine Documentation

◆ extract_coupler_values() [1/2]

subroutine, public coupler_util::extract_coupler_values ( type(coupler_2d_bc_type), intent(in)  BC_struc,
integer, intent(in)  BC_index,
integer, intent(in)  BC_element,
real, dimension(:,:), intent(out)  array_out,
integer, intent(in), optional  is,
integer, intent(in), optional  ie,
integer, intent(in), optional  js,
integer, intent(in), optional  je,
real, intent(in), optional  conversion 
)

Definition at line 37 of file coupler_util.F90.

References coupler_types_mod::ind_csurf, and mom_error_handler::mom_error().

37  type(coupler_2d_bc_type), intent(in) :: bc_struc
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
42 ! Arguments: BC_struc - The type from which the data is being extracted.
43 ! (in) BC_index - The boundary condition number being extracted.
44 ! (in) BC_element - The element of the boundary condition being extracted.
45 ! This could be ind_csurf, ind_alpha, ind_flux or ind_deposition.
46 ! (out) array_out - The array being filled with the input values.
47 ! (in, opt) is, ie, js, je - The i- and j- limits of array_out to be filled.
48 ! These must match the size of the corresponding value array or an
49 ! error message is issued.
50 ! (in, opt) conversion - A number that every element is multiplied by, to
51 ! permit sign convention or unit conversion.
52 
53  real, pointer, dimension(:,:) :: array_in
54  real :: conv
55  integer :: i, j, is0, ie0, js0, je0, i_offset, j_offset
56 
57  if ((bc_element /= ind_flux) .and. (bc_element /= ind_alpha) .and. &
58  (bc_element /= ind_csurf)) then
59  call mom_error(fatal,"extract_coupler_values: Unrecognized BC_element.")
60  endif
61 
62  ! These error messages should be made more explicit.
63 ! if (.not.associated(BC_struc%bc(BC_index))) &
64  if (.not.associated(bc_struc%bc)) &
65  call mom_error(fatal,"extract_coupler_values: " // &
66  "The requested boundary condition is not associated.")
67 ! if (.not.associated(BC_struc%bc(BC_index)%field(BC_element))) &
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.")
74 
75  array_in => bc_struc%bc(bc_index)%field(bc_element)%values
76 
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
81 
82  conv = 1.0 ; if (present(conversion)) conv = conversion
83 
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)
94  enddo ; enddo
95 
Here is the call graph for this function:

◆ extract_coupler_values() [2/2]

subroutine, public coupler_util::extract_coupler_values ( type(coupler_2d_bc_type), intent(in)  BC_struc,
integer, intent(in)  BC_index,
integer, intent(in)  BC_element,
real, dimension(:,:), intent(inout)  array_out,
integer, intent(in), optional  is,
integer, intent(in), optional  ie,
integer, intent(in), optional  js,
integer, intent(in), optional  je,
real, intent(in), optional  conversion 
)

Definition at line 42 of file coupler_types.F90.

References mom_error_handler::mom_error().

42  type(coupler_2d_bc_type), intent(in) :: bc_struc
43  integer, intent(in) :: bc_index, bc_element
44  real, dimension(:,:), intent(inout) :: array_out
45  integer, optional, intent(in) :: is, ie, js, je
46  real, optional, intent(in) :: conversion
47 
48 ! Arguments: BC_struc - The type from which the data is being extracted.
49 ! (in) BC_index - The boundary condition number being extracted.
50 ! (in) BC_element - The element of the boundary condition being extracted.
51 ! This could be ind_csurf, ind_alpha, ind_flux or ind_deposition.
52 ! (out) array_out - The array being filled with the input values.
53 ! (in, opt) is, ie, js, je - The i- and j- limits of array_out to be filled.
54 ! These must match the size of the corresponding value array or an
55 ! error message is issued.
56 ! (in, opt) conversion - A number that every element is multiplied by, to
57 ! permit sign convention or unit conversion.
58 
59  call mom_error(fatal,"The called version of extract_coupler_values does" // &
60  " nothing but issue this fatal error message.")
61 
Here is the call graph for this function:

◆ set_coupler_values()

subroutine public coupler_util::set_coupler_values ( real, dimension(:,:), intent(in)  array_in,
type(coupler_2d_bc_type), intent(inout)  BC_struc,
integer, intent(in)  BC_index,
integer, intent(in)  BC_element,
integer, intent(in), optional  is,
integer, intent(in), optional  ie,
integer, intent(in), optional  js,
integer, intent(in), optional  je,
real, intent(in), optional  conversion 
)

Definition at line 66 of file coupler_types.F90.

References mom_error_handler::mom_error().

Referenced by advection_test_tracer::advection_test_tracer_surface_state(), boundary_impulse_tracer::boundary_impulse_tracer_surface_state(), ideal_age_example::ideal_age_tracer_surface_state(), isomip_tracer::isomip_tracer_surface_state(), pseudo_salt_tracer::pseudo_salt_tracer_surface_state(), and user_tracer_example::user_tracer_surface_state().

66  real, dimension(:,:), intent(in) :: array_in
67  type(coupler_2d_bc_type), intent(inout) :: bc_struc
68  integer, intent(in) :: bc_index, bc_element
69  integer, optional, intent(in) :: is, ie, js, je
70  real, optional, intent(in) :: conversion
71 
72 ! Arguments: array_in - The array containing the values to load into the BC.
73 ! (out) BC_struc - The type into which the data is being loaded.
74 ! (in) BC_index - The boundary condition number being extracted.
75 ! (in) BC_element - The element of the boundary condition being extracted.
76 ! This could be ind_csurf, ind_alpha, ind_flux or ind_deposition.
77 ! (in, opt) is, ie, js, je - The i- and j- limits of array_out to be filled.
78 ! These must match the size of the corresponding value array or an
79 ! error message is issued.
80 ! (in, opt) conversion - A number that every element is multiplied by, to
81 ! permit sign convention or unit conversion.
82 
83  call mom_error(fatal,"The called version of set_coupler_values does" // &
84  " nothing but issue this fatal error message.")
85 
Here is the call graph for this function:
Here is the caller graph for this function: