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

Polish

parent d4935475
No related branches found
No related tags found
No related merge requests found
......@@ -15,11 +15,16 @@ contains
! Sorts ssh_lev in ascending order.
real, intent(inout):: ssh_lev(:) ! (n_max_cont)
! Defined only for subscripts 1:n_cont.
integer, intent(inout):: n_cont
! On entry, 2 <= n_cont <= n_max_cont - 1. On return, 2 <= n_cont
! <= n_max_cont.
! Local:
real delta_ssh(size(sort_ssh) - 1) ! (n_max_cont - 1)
integer i, n_max_cont
real delta_ssh(size(ssh_lev) - 1) ! (n_max_cont - 1)
integer i
integer n_max_cont ! >= 3
real delta_ssh_new
real, parameter:: delta_ssh_min = 1e-3 ! in m
......@@ -32,6 +37,7 @@ contains
sort_ssh(:n_cont) = [(i, i = 1, n_cont)]
i = 1
else
! Anticyclone
sort_ssh(:n_cont) = [(i, i = n_cont, 1, - 1)]
i = n_cont - 1
end if
......
......@@ -26,7 +26,9 @@ contains
! extremum is a maximum. The area is only computed for the
! outermost contour. On return, the array
! abs(ediff1d(cont_list(:n_cont)%ssh)) is in descending
! order. (See notes for a proof.)
! order. (See notes for a proof.) On return, n_cont == 1 means we
! have only found one good contour at innermost_level_2 and it has
! sufficient area.
! Method: dichotomy on level of ssh.
......@@ -57,7 +59,7 @@ contains
! 1) are not oriented.
integer, intent(out):: n_cont
! number of good contours found and stored, >= 0
! number of good contours found and stored, 0 <= n_cont <= n_max_cont - 1
logical, intent(in):: cyclone
real, intent(in):: coord_extr(:) ! (2)
......@@ -86,7 +88,7 @@ contains
real level_try, level_good, level_bad ! in m
real, parameter:: precision = 5e-4 ! in m
logical mask(size(ssh, 1), size(ssh, 2))
integer n_max_cont
integer n_max_cont ! >= 3
!-----------------------------------------------------------------
......@@ -142,6 +144,7 @@ contains
! level_good) and cont_list(n_cont)%%n_points /= 0 and
! no good contour at level_bad
end do
! Assertion: n_cont <= n_max_cont - 1
end if
cont_list(n_cont)%area = spher_polyline_area(cont_list(n_cont)%polyline)
......
......@@ -6,8 +6,7 @@ contains
subroutine set_all_contours(s, step, periodic, ssh, u, v, corner)
! This procedure sets all outermost contours in the snapshot
! "s".
! This procedure sets all contours in the snapshot "s".
! Libraries:
use contour_531, only: convert_to_ind
......@@ -22,9 +21,9 @@ contains
use set_max_speed_m, only: set_max_speed
type(snapshot), intent(inout):: s
! Define s%list%out_cont. s%number_extr, s%list%cyclone,
! s%list%extr, s%list%innermost_level, s%extr_map should be
! defined on entry.
! Define s%list%out_cont, s%list%speed_cont and
! s%list%max_speed. s%number_extr, s%list%cyclone, s%list%extr,
! s%list%innermost_level, s%extr_map should be defined on entry.
real, intent(in):: step(:) ! (2) longitude and latitude steps, in rad
logical, intent(in):: periodic ! grid is periodic in longitude
......@@ -66,7 +65,7 @@ contains
! latitude, in rad, of all the significant extrema, except the
! target extremum
integer, parameter:: n_max_cont = 31
integer, parameter:: n_max_cont = 31 ! must be >= 3
type(ssh_contour) cont_list(n_max_cont)
! Contour list. Defined only for subscripts 1:n_cont. If n_cont >=
......@@ -75,7 +74,9 @@ contains
! cont_list(:n_cont - 1)%area are missing and cont_list(:n_cont -
! 1) are not oriented.
integer n_cont ! number of good contours found and stored in cont_list, >= 0
integer n_cont
! number of good contours found and stored in cont_list, 0 <=
! n_cont <= n_max_cont
!--------------------------------------------------------------
......
......@@ -24,19 +24,20 @@ contains
use spher_polyline_area_m, only: spher_polyline_area
type(eddy), intent(inout):: e
! e%out_cont, e%cyclone, e%extr%ssh and e%extr%coord
! should be defined on input.
! e%extr%coord should be defined on input.
type(ssh_contour), intent(inout):: cont_list(:) ! (n_max_cont)
! Contour list. Defined only for subscripts 1:n_cont. The
! outermost contour is element with subscript n_cont. The contours
! are in monotonic order of ssh. If n_cont >= 2, cont_list(:n_cont
! - 1)%area are missing and cont_list(:n_cont - 1) are not
! oriented.
! Contour list. Defined only for subscripts 1:n_cont. On entry,
! the outermost contour is element with subscript n_cont. The
! contours between 1 and i_outer are in monotonic order of
! ssh. For i /= i_outer, cont_list(i)%area is missing and
! cont_list(i) is not oriented.
integer, intent(inout):: n_cont
! number of good contours found and stored in cont_list, 1 <=
! n_cont <= n_max_cont
! Number of good contours found and stored in cont_list. On entry,
! 1 <= n_cont <= n_max_cont - 1 (not 0 because set_max_speed is
! only called when there is an outermost contour). On return, 1 <=
! n_cont <= n_max_cont.
real, intent(in):: ssh(:, :), u(:, :), v(:, :)
! The domain should be the bounding box of out_cont, because we do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment