Build a HyCOM coordinate column.
99 type(hycom_CS),
intent(in) :: CS
100 type(EOS_type),
pointer :: eqn_of_state
101 integer,
intent(in) :: nz
102 real,
intent(in) :: depth
103 real,
dimension(nz),
intent(in) :: T
104 real,
dimension(nz),
intent(in) :: S
105 real,
dimension(nz),
intent(in) :: h
106 real,
dimension(nz),
intent(in) :: p_col
107 real,
dimension(nz+1),
intent(in) :: z_col
108 real,
dimension(CS%nk+1),
intent(inout) :: z_col_new
109 real,
optional,
intent(in) :: zScale
111 real,
optional,
intent(in) :: h_neglect
114 real,
optional,
intent(in) :: h_neglect_edge
120 real,
dimension(nz) :: rho_col
121 real,
dimension(CS%nk) :: h_col_new
126 logical :: maximum_depths_set
127 logical :: maximum_h_set
129 maximum_depths_set =
allocated(cs%max_interface_depths)
130 maximum_h_set =
allocated(cs%max_layer_thickness)
132 z_scale = 1.0 ;
if (
present(zscale)) z_scale = zscale
135 call calculate_density(t, s, p_col, rho_col, 1, nz, eqn_of_state)
139 rho_col(k) = min( rho_col(k), rho_col(k+1) )
144 call build_and_interpolate_grid(cs%interp_CS, rho_col, nz, h(:), z_col, &
145 cs%target_density, cs%nk, h_col_new, z_col_new, h_neglect, h_neglect_edge)
150 stretching = z_col(nz+1) / depth
152 nominal_z = nominal_z + (z_scale * cs%coordinateResolution(k-1)) * stretching
153 z_col_new(k) = max( z_col_new(k), nominal_z )
154 z_col_new(k) = min( z_col_new(k), z_col(nz+1) )
157 if (maximum_depths_set .and. maximum_h_set)
then ;
do k=2,cs%nk
160 z_col_new(k) = min(z_col_new(k), cs%max_interface_depths(k), &
161 z_col_new(k-1) + cs%max_layer_thickness(k-1))
162 enddo ;
elseif (maximum_depths_set)
then ;
do k=2,cs%nk
163 z_col_new(k) = min(z_col_new(k), cs%max_interface_depths(k))
164 enddo ;
elseif (maximum_h_set)
then ;
do k=2,cs%nk
165 z_col_new(k) = min(z_col_new(k), z_col_new(k-1) + cs%max_layer_thickness(k-1))