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

Replace module variable `min_radius` by `min_area`

It is `min_area` that we need in the code, in `get_1_outerm`. Instead
of computing it in the main program and trickling it down to
`get_1_outerm`, define it in `config_m`.
parent f0e6c065
No related branches found
No related tags found
No related merge requests found
......@@ -2,13 +2,13 @@ program examine_eddy
! Libraries:
use contour_531, only: convert_to_ind
use jumble, only: get_command_arg_dyn, read_column, deg_to_rad, pi, &
rad_to_deg, twopi, new_unit
use jumble, only: get_command_arg_dyn, read_column, deg_to_rad, rad_to_deg, &
twopi, new_unit
use shapelib, only: shpfileobject, shpclose
use shapelib_03, only: dbf_read_attribute_03, dbf_get_field_index_03, &
shp_read_point, shp_open_03
use config_m, only: config, min_radius
use config_m, only: config
use cont_list_m, only: create_cont_list, close_cont_list
use derived_types, only: snapshot, shpc_slice_handler, eddy
use input_ssh_m, only: input_ssh, max_radius
......@@ -169,7 +169,7 @@ program examine_eddy
call set_contours(e%out_cont, e%speed_cont, e%max_speed, cyclone, e%extr, &
e%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, pi * (min_radius * 1e3)**2, outside_points)
corner_window, outside_points)
call close_cont_list
call shpc_create(hshpc, shpc_dir = "SHPC", cyclone = cyclone, slice = 0, &
grid_lon_lat = .true.)
......
program test_get_1_outerm
! Libraries:
use jumble, only: csvread, deg_to_rad, rad_to_deg, pi
use jumble, only: csvread, deg_to_rad, rad_to_deg
use shapelib, only: shpfileobject, ftdouble, shpt_polygon, shpclose
use shapelib_03, only: shp_create_03, dbf_add_field_03, &
shp_append_object_03, dbf_write_attribute_03
use config_m, only: config, min_radius
use config_m, only: config
use derived_types, only: eddy, shpc_slice_handler, null_ssh_contour, &
missing_speed, ssh_contour
use get_1_outerm_m, only: get_1_outerm
......@@ -82,8 +82,7 @@ program test_get_1_outerm
e%extr%coord_proj = ind_targ_extr
e%extr%coord = corner + (ind_targ_extr - 1) * step
call get_1_outerm(e%out_cont, cont_list, n_cont, cyclone, e%extr%coord, &
innermost_level, outside_points, ssh, corner, step, &
min_area = pi * (min_radius * 1e3)**2)
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))
......
module config_m
use, intrinsic:: ISO_FORTRAN_ENV
use jumble, only: pi
implicit none
......@@ -13,8 +14,9 @@ module config_m
! degrees. Beware: run time is roughly proportional to
! product(max_radius_deg / step_deg). max_radius_deg(1) must be < 90.
real, protected:: min_radius = 25.
! minimum radius of the equal-area disk for an outermost contour, in km
real, protected, save:: min_area ! minimum area of an outermost contour, in m2
private pi
contains
......@@ -24,8 +26,13 @@ contains
use jumble, only: new_unit
! Local:
logical exist
integer unit, iostat
real:: min_radius = 25.
! minimum radius of the equal-area disk for an outermost contour, in km
namelist /config_nml/ min_amp, max_radius_deg, min_radius
character(len = 1000) iomsg
......@@ -59,6 +66,8 @@ contains
close(unit)
end if
min_area = pi * (min_radius * 1e3)**2
end subroutine config
end module config_m
......@@ -5,7 +5,7 @@ module get_1_outerm_m
contains
subroutine get_1_outerm(out_cont, cont_list, n_cont, cyclone, coord_extr, &
innermost_level_2, outside_points, ssh, corner, step, min_area)
innermost_level_2, outside_points, ssh, corner, step)
! This procedure gets one outermost good contour with sufficient
! area, if it can find one. If the procedure cannot find an
......@@ -45,6 +45,7 @@ contains
use jumble, only: assert
use ccw_orient_m, only: ccw_orient
use config_m, only: min_area
use derived_types, only: ssh_contour, null_ssh_contour
use good_contour_m, only: good_contour
use spher_polyline_area_m, only: spher_polyline_area
......@@ -82,9 +83,6 @@ contains
real, intent(in):: step(:) ! (2)
! longitude and latitude steps, in rad
real, intent(in):: min_area
! minimum area of an outermost contour, in m2
! Local:
real level_try, level_good, level_bad ! in m
real, parameter:: precision = 5e-4 ! in m
......
......@@ -7,10 +7,10 @@ program inst_eddies
use, intrinsic:: ISO_FORTRAN_ENV, only: ERROR_UNIT
! Libraries:
use jumble, only: assert, new_unit, pi, argwhere, twopi
use jumble, only: assert, new_unit, argwhere, twopi
use numer_rec_95, only: indexx
use config_m, only: config, min_radius
use config_m, only: config
use derived_types, only: snapshot, shpc_slice_handler
use input_ssh_m, only: input_ssh, max_radius
use nearby_extr_m, only: nearby_extr
......@@ -54,8 +54,6 @@ program inst_eddies
! order of decreasing SSH, and second, maxima sorted in order of
! increasing SSH.
real min_area ! minimum area of an outermost contour, in m2
integer, allocatable:: selection(:)
! identifying numbers of a selection of extrema
......@@ -121,7 +119,6 @@ program inst_eddies
call set_all_extr(s, step, periodic, ssh, corner)
allocate(sorted_extr(s%number_extr))
min_area = pi * (min_radius * 1e3)**2
forall (i = 1:s%number_extr)
s%list(i)%out_cont%closed = .true.
......@@ -177,7 +174,7 @@ program inst_eddies
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)
corner_window, outside_points)
end do
call cpu_time(t1)
......
......@@ -5,7 +5,7 @@ module set_contours_m
contains
subroutine set_contours(out_cont, speed_cont, max_speed, cyclone, extr, &
innermost_level, step, ssh, u, v, corner, min_area, outside_points)
innermost_level, step, ssh, u, v, corner, outside_points)
! This procedure sets contours in an eddy.
......@@ -44,8 +44,6 @@ contains
real, intent(in):: corner(:) ! (2) longitude and latitude of the
! corner of the grid, in rad
real, intent(in):: min_area ! minimum area of an outermost contour, in m2
real, intent(in):: outside_points(:, :) ! (2, :) longitude and
! latitude, in rad, of all the significant extrema, except the
! target extremum
......@@ -83,7 +81,7 @@ contains
innermost_level, abs(extr%ssh - innermost_level) < min_amp)
call get_1_outerm(out_cont, cont_list, n_cont, cyclone, extr%coord, &
innermost_level_2, outside_points, ssh, corner, step, min_area)
innermost_level_2, outside_points, ssh, corner, step)
! Done with outermost contour, now let us take care of the
! max-speed contour.
......
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