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

Pass `corner_proj` to `mean_speed`

Pass `corner_proj` instead of corner to `mean_speed`, avoiding a
repeated computation.
parent 92d156ac
No related branches found
No related tags found
No related merge requests found
......@@ -72,7 +72,7 @@ program test_mean_speed
end if
print *, "mean azimuthal speed = ", mean_speed(u, v, p%part(1), &
convert_to_ind(p%part(1)%points, corner, step), center, corner, step), &
"m s-1"
convert_to_ind(p%part(1)%points, corner, step), center, &
corner_proj = [1., 1.]), "m s-1"
end program test_mean_speed
......@@ -4,7 +4,7 @@ module mean_speed_m
contains
real function mean_speed(u, v, p, points_xy, center, corner, step)
real function mean_speed(u, v, p, points_xy, center, corner_proj)
! Interpolates the wind at each point of the input polyline and
! computes the mean azimuthal speed at interpolation points. We
......@@ -20,8 +20,6 @@ contains
use numer_rec_95, only: bilinear_interp2_reg
use jumble, only: rad_to_deg
use input_ssh_m, only: corner_whole => corner
real, intent(in):: u(:, :), v(:, :) ! velocity
type(polyline), intent(in):: p
......@@ -35,10 +33,9 @@ contains
! Longitude and latitude, in rad. Azimuthal speed is computed with
! respect to this point.
real, intent(in):: corner(:) ! (2)
! longitude and latitude corresponding to u(1,1) and v(1, 1), in rad
real, intent(in):: step(:) ! (2) ! longitude and latitude steps, in rad
real, intent(in):: corner_proj(:) ! (2)
! coordinates in projection space of the point corresponding to
! u(1,1) and v(1, 1)
! Local:
......@@ -56,16 +53,15 @@ contains
write(error_unit, fmt = *) &
"mean_speed: requires non-null, closed contour"
write(error_unit, fmt = *) "center (in °) = ", center * rad_to_deg
write(error_unit, fmt = *) "corner (in °) = ", corner * rad_to_deg
write(error_unit, fmt = *) "step (in °) = ", step * rad_to_deg
write(error_unit, fmt = *) "corner_proj = ", corner_proj
write(error_unit, fmt = *) "p%n_points = ", p%n_points
write(error_unit, fmt = *) "Aborting."
stop 1
end if
ni = p%n_points - 1
call bilinear_interp2_reg((corner - corner_whole) / step + 1., [1., 1.], &
u, v, points_xy(:, :ni), ui, vi)
call bilinear_interp2_reg(corner_proj, [1., 1.], u, v, points_xy(:, :ni), &
ui, vi)
do j = 1, ni
x = cos(center(2)) * (p%points(1, j) - center(1))
......
......@@ -110,7 +110,7 @@ contains
do i = 1, n_cont
if (cont_list(i)%closed) then
speed(i) = mean_speed(u, v, cont_list(i), cont_list_proj(i)%points, &
extr_coord, corner, step)
extr_coord, corner_proj)
else
! It is possible that good_contour returned a null polyline
! if there is a missing value of SSH inside the outermost
......
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