From deaf70f24fbbcfdb0102c7b91670d200e238b03a Mon Sep 17 00:00:00 2001 From: Lionel GUEZ <guez@lmd.ens.fr> Date: Wed, 1 Feb 2023 00:03:55 +0100 Subject: [PATCH] Add arguments to `get_1_outerm` Add dummy arguments `cont_list` and `n_cont` to `get_1_outerm`. --- Inst_eddies/Tests/test_get_1_outerm.f90 | 13 ++++++++++--- Inst_eddies/get_1_outerm.f90 | 19 ++++++++++--------- Inst_eddies/set_all_outerm.f90 | 17 +++++++++++++---- 3 files changed, 33 insertions(+), 16 deletions(-) diff --git a/Inst_eddies/Tests/test_get_1_outerm.f90 b/Inst_eddies/Tests/test_get_1_outerm.f90 index 86483f57..c113308e 100644 --- a/Inst_eddies/Tests/test_get_1_outerm.f90 +++ b/Inst_eddies/Tests/test_get_1_outerm.f90 @@ -5,7 +5,7 @@ program test_get_1_outerm use config_m, only: config use derived_types, only: eddy, shpc_slice_handler, null_ssh_contour, & - missing_speed + missing_speed, ssh_contour use get_1_outerm_m, only: get_1_outerm use input_ssh_m, only: input_ssh use shpc_close_m, only: shpc_close @@ -50,6 +50,13 @@ program test_get_1_outerm ! target extremum logical:: grid_lon_lat = .true. + integer, parameter:: n_max_cont = 31 + + type(ssh_contour) cont_list(n_max_cont + 1) + ! Contour list. The outermost contour is element n_cont. The + ! contours are in monotonic order of ssh. + + integer n_cont ! number of good contours found and stored in cont_list namelist /main_nml/ ind_targ_extr, innermost_level, cyclone, date, & grid_lon_lat @@ -66,8 +73,8 @@ program test_get_1_outerm outside_points = transpose(outside_points) * deg_to_rad e%extr%coord_proj = ind_targ_extr e%extr%coord = corner + (ind_targ_extr - 1) * step - call get_1_outerm(e%out_cont, cyclone, e%extr%coord, innermost_level, & - outside_points, ssh, corner, step) + call get_1_outerm(e%out_cont, cont_list, n_cont, cyclone, e%extr%coord, & + innermost_level, outside_points, ssh, corner, step) if (e%out_cont%closed) then e%extr%ssh = ssh(ind_targ_extr(1), ind_targ_extr(2)) diff --git a/Inst_eddies/get_1_outerm.f90 b/Inst_eddies/get_1_outerm.f90 index f0cd2d07..c2909e64 100644 --- a/Inst_eddies/get_1_outerm.f90 +++ b/Inst_eddies/get_1_outerm.f90 @@ -4,8 +4,8 @@ module get_1_outerm_m contains - subroutine get_1_outerm(out_cont, cyclone, coord_extr, innermost_level_2, & - outside_points, ssh, corner, step) + subroutine get_1_outerm(out_cont, cont_list, n_cont, cyclone, coord_extr, & + innermost_level_2, outside_points, ssh, corner, step) ! This procedure gets one outermost good contour, if it can find ! one. If the procedure cannot find an outermost contour, it @@ -44,6 +44,12 @@ contains use spher_polyline_area_m, only: spher_polyline_area type(ssh_contour), intent(out):: out_cont + + type(ssh_contour), intent(out):: cont_list(:) ! (n_max_cont + 1) + ! Contour list. The outermost contour is element n_cont. The + ! contours are in monotonic order of ssh. + + integer, intent(out):: n_cont ! number of good contours found and stored logical, intent(in):: cyclone real, intent(in):: coord_extr(:) ! (2) @@ -68,16 +74,11 @@ 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, parameter:: n_max_cont = 31 - - type(ssh_contour) cont_list(n_max_cont + 1) - ! Contour list. The outermost contour is element n_cont. The - ! contours are in monotonic order of ssh. - - integer n_cont ! number of good contours found and stored + integer n_max_cont !----------------------------------------------------------------- + n_max_cont = size(cont_list) - 1 n_cont = 0 cont_list(1)%polyline = good_contour(corner, step, ssh, innermost_level_2, & coord_extr, outside_points) diff --git a/Inst_eddies/set_all_outerm.f90 b/Inst_eddies/set_all_outerm.f90 index 9da85966..96eca3dc 100644 --- a/Inst_eddies/set_all_outerm.f90 +++ b/Inst_eddies/set_all_outerm.f90 @@ -14,7 +14,7 @@ contains use numer_rec_95, only: indexx use config_m, only: min_amp - use derived_types, only: snapshot, null_ssh_contour + use derived_types, only: snapshot, null_ssh_contour, ssh_contour use get_1_outerm_m, only: get_1_outerm use input_ssh_m, only: max_radius use nearby_extr_m, only: nearby_extr @@ -64,6 +64,14 @@ contains ! latitude, in rad, of all the significant extrema, except the ! target extremum + integer, parameter:: n_max_cont = 31 + + type(ssh_contour) cont_list(n_max_cont + 1) + ! Contour list. The outermost contour is element n_cont. The + ! contours are in monotonic order of ssh. + + integer n_cont ! number of good contours found and stored in cont_list + !-------------------------------------------------------------- if (.not. periodic) nlon = size(ssh, 1) @@ -118,9 +126,10 @@ contains + ceiling((corner_window(1) - outside_points(1, :)) / twopi) * twopi ! (Shift the longitude of each point to a value close to the ! longitude of the target extremum.) - call get_1_outerm(s%list(i)%out_cont, s%list(i)%cyclone, & - s%list(i)%extr%coord, innermost_level_2, outside_points, & - ssh(llc(1):urc(1), llc(2):urc(2)), corner_window, step) + call get_1_outerm(s%list(i)%out_cont, cont_list, n_cont, & + s%list(i)%cyclone, s%list(i)%extr%coord, innermost_level_2, & + outside_points, ssh(llc(1):urc(1), llc(2):urc(2)), corner_window, & + step) s%list(i)%valid = s%list(i)%out_cont%area >= min_area if (.not. s%list(i)%valid) s%list(i)%out_cont = null_ssh_contour() end do -- GitLab