Skip to content
Snippets Groups Projects
Commit f732085c authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Split dummy argument `e` into relevant components

Split dummy argument `e` of `set_contours` into relevant components.
Motivation: make appear clearly input and output.
parent 6ceed70b
No related branches found
No related tags found
No related merge requests found
......@@ -174,7 +174,9 @@ program inst_eddies
+ ceiling((corner_window(1) - outside_points(1, :)) / twopi) &
* twopi
call set_contours(s%list(i), step, ssh(llc(1):urc(1), llc(2):urc(2)), &
call set_contours(s%list(i)%out_cont, s%list(i)%speed_cont, &
s%list(i)%max_speed, s%list(i)%cyclone, s%list(i)%extr, &
s%list(i)%innermost_level, step, ssh(llc(1):urc(1), llc(2):urc(2)), &
u(llc(1):urc(1), llc(2):urc(2)), v(llc(1):urc(1), llc(2):urc(2)), &
corner_window, min_area, outside_points)
end do
......
......@@ -4,21 +4,37 @@ module set_contours_m
contains
subroutine set_contours(e, step, ssh, u, v, corner, min_area, outside_points)
subroutine set_contours(out_cont, speed_cont, max_speed, cyclone, extr, &
innermost_level, step, ssh, u, v, corner, min_area, outside_points)
! This procedure sets contours in the eddy "e".
! This procedure sets contours in an eddy.
! Libraries:
use contour_531, only: convert_to_ind
use config_m, only: min_amp
use derived_types, only: eddy, null_ssh_contour, ssh_contour
use derived_types, only: extremum, null_ssh_contour, ssh_contour
use get_1_outerm_m, only: get_1_outerm
use set_max_speed_m, only: set_max_speed
type(eddy), intent(inout):: e
! Define e%out_cont, e%speed_cont and e%max_speed. e%cyclone,
! e%extr and e%innermost_level should be defined on entry.
type(ssh_contour), intent(out):: out_cont ! outermost contour
type(ssh_contour), intent(out):: speed_cont
! contour with maximum average azimuthal speed
real, intent(out):: max_speed
! Average of azimuthal speed on out_cont or speed_cont, in m
! s-1. Positive means counterclockwise circulation. If speed_cont
! is not a null ssh contour then max_speed is the speed on
! speed_cont.
logical, intent(in):: cyclone
type(extremum), intent(in):: extr
real, intent(in):: innermost_level
! SSH level of the innermost contour around each extremum, in
! m. By construction, innermost_level < extremum for a maximum, >
! extremum for a minimum.
real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad
......@@ -63,22 +79,21 @@ contains
!--------------------------------------------------------------
! Only look for good contours with amplitudes >= min_amp:
innermost_level_2 = merge(e%extr%ssh + merge(min_amp, - min_amp, &
e%cyclone), e%innermost_level, &
abs(e%extr%ssh - e%innermost_level) < min_amp)
innermost_level_2 = merge(extr%ssh + merge(min_amp, - min_amp, cyclone), &
innermost_level, abs(extr%ssh - innermost_level) < min_amp)
call get_1_outerm(e%out_cont, cont_list, n_cont, e%cyclone, e%extr%coord, &
call get_1_outerm(out_cont, cont_list, n_cont, cyclone, extr%coord, &
innermost_level_2, outside_points, ssh, corner, step, min_area)
! Done with outermost contour, now let us take care of the
! max-speed contour.
if (e%out_cont%closed) then
if (out_cont%closed) then
! Restrict the field to the outermost contour:
llc = floor(convert_to_ind(minval(e%out_cont%points, dim = 2), corner, &
llc = floor(convert_to_ind(minval(out_cont%points, dim = 2), corner, &
step))
urc = ceiling(convert_to_ind(maxval(out_cont%points, dim = 2), corner, &
step))
urc = ceiling(convert_to_ind(maxval(e%out_cont%points, dim = 2), &
corner, step))
! Should have no effect except because of roundup error:
urc(2) = min(urc(2), size(ssh, 2))
......@@ -88,8 +103,8 @@ contains
! Done restricting field
call set_max_speed(e%speed_cont, e%max_speed, cont_list, n_cont, &
e%extr%coord, ssh(llc(1):urc(1), llc(2):urc(2)), &
call set_max_speed(speed_cont, max_speed, cont_list, n_cont, &
extr%coord, ssh(llc(1):urc(1), llc(2):urc(2)), &
u(llc(1):urc(1), llc(2):urc(2)), &
v(llc(1):urc(1), llc(2):urc(2)), corner_window, step)
end if
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment