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

Do not create `number_eddies.csv` in `eddy_graph`

Do not create file `number_eddies.csv` in program `eddy_graph`. Since
there are no interpolated eddies any longer, the file
`number_eddies.csv` just contained the same information that is in
`ishape_last.txt` in the input SHPC. Remove argument
`unit_number_eddies` of procedure `dispatch_snapshot`.
parent 366f042b
No related branches found
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ program test_get_dispatch_snap
type(snapshot) s
TYPE(shpc) hshp
integer k_begin, d_init, copy, rank, n_proc, k_end, n_dates
integer unit_isolated, unit_number_eddies
integer unit_isolated
real:: corner(2) = [0.125, - 59.875]
! longitude and latitude of the corner of the whole grid in input
......@@ -81,9 +81,6 @@ program test_get_dispatch_snap
call new_unit(unit_isolated)
open(unit_isolated, file = "isolated_nodes.txt", status = "replace", &
action = "write")
call new_unit(unit_number_eddies)
open(unit_number_eddies, file = "number_eddies.csv", status = "replace", &
action = "write")
end if
call ezmpi_bcast(corner, root = 0)
......@@ -111,13 +108,12 @@ program test_get_dispatch_snap
step * deg_to_rad, copy, hshp, d_init, k, k_end, rank, n_proc, &
max_delta = 1)
CALL shpc_close(hshp)
call dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, k_begin, &
max_delta = 1, d_init = d_init, k = k)
call dispatch_snapshot(s, unit_isolated, rank, k_begin, max_delta = 1, &
d_init = d_init, k = k)
if (rank == 0) then
call write_snapshot(s, corner, step, nlon, nlat, copy, d = d_init + k)
close(unit_isolated)
close(unit_number_eddies)
end if
call mpi_finalize
......
......@@ -4,8 +4,8 @@ module dispatch_snapshot_m
contains
subroutine dispatch_snapshot(s, unit_isolated, unit_number_eddies, rank, &
k_begin, max_delta, d_init, k)
subroutine dispatch_snapshot(s, unit_isolated, rank, k_begin, max_delta, &
d_init, k)
use derived_types, only: snapshot
use send_snapshot_m, only: send_snapshot
......@@ -15,9 +15,6 @@ contains
integer, intent(in):: unit_isolated
! logical unit for file isolated_nodes_$rank.csv
integer, intent(in):: unit_number_eddies
! logical unit for file number_eddies_$rank.csv
integer, intent(in):: rank, k_begin, max_delta, d_init
integer, intent(in):: k ! date index (0-based)
......@@ -34,8 +31,6 @@ contains
.and. s%list_vis(i)%delta_out == huge(0)) &
write(unit_isolated, fmt = *) d, i
end do
write(unit_number_eddies, fmt = *) d, s%number_vis_extr
else
call send_snapshot(s, tag = k, dest = rank - 1)
end if
......
......@@ -54,7 +54,7 @@ program eddy_graph
! shape index (0-based) in the collection of shapefiles of the last
! shape at a given date index
integer unit_isolated, unit_number_eddies, unit
integer unit_isolated, unit
TYPE(shpc) hshp
type(snapshot), allocatable:: flow(:)
character(len = 30) file
......@@ -124,11 +124,6 @@ program eddy_graph
write(unit = file, fmt = '("isolated_nodes_", i0, ".txt")') rank
open(unit_isolated, file = trim(file), status = "replace", action = "write")
call new_unit(unit_number_eddies)
write(unit = file, fmt = '("number_eddies_", i0, ".csv")') rank
open(unit_number_eddies, file = trim(file), status = "replace", &
action = "write")
call open_edge_file(rank)
! We do not write the title line. That will be handled by eddy_graph.sh.
......@@ -161,8 +156,8 @@ program eddy_graph
! 3. Main loop
do k = k_begin + max_delta + 1, k_end_main_loop
call dispatch_snapshot(flow(1), unit_isolated, unit_number_eddies, rank, &
k_begin, max_delta, d_init, k = k - max_delta - 1)
call dispatch_snapshot(flow(1), unit_isolated, rank, k_begin, max_delta, &
d_init, k = k - max_delta - 1)
flow(:max_delta) = flow(2:)
call get_snapshot(flow(max_delta + 1), nlon, nlat, ishape_last, corner, &
step, copy, hshp, d_init, k, k_end, rank, n_proc, max_delta)
......@@ -178,8 +173,8 @@ program eddy_graph
do k = k_end_main_loop + 1, k_end
! {rank < n_proc - 1 and k >= k_end - max_delta + 2}
call dispatch_snapshot(flow(1), unit_isolated, unit_number_eddies, rank, &
k_begin, max_delta, d_init, k = k - max_delta - 1)
call dispatch_snapshot(flow(1), unit_isolated, rank, k_begin, max_delta, &
d_init, k = k - max_delta - 1)
flow(:max_delta) = flow(2:)
call get_snapshot(flow(max_delta + 1), nlon, nlat, ishape_last, corner, &
step, copy, hshp, d_init, k, k_end, rank, n_proc, max_delta)
......@@ -196,15 +191,14 @@ program eddy_graph
end do
do j = 1, max_delta + 1
call dispatch_snapshot(flow(j), unit_isolated, unit_number_eddies, rank, &
k_begin, max_delta, d_init, k = k_end - max_delta - 1 + j)
call dispatch_snapshot(flow(j), unit_isolated, rank, k_begin, max_delta, &
d_init, k = k_end - max_delta - 1 + j)
end do
! 5. Back matter
CALL shpc_close(hshp)
close(unit_isolated)
close(unit_number_eddies)
close(unit_edge)
call mpi_finalize
......
......@@ -3,8 +3,6 @@
# This program creates the edge list for a given orientation of
# eddies.
# Note: no need to sort number_eddies.csv, already sorted by construction.
if (($# != 2))
then
echo "Usage: eddy_graph.sh N_PROC INPUT_SHPC"
......@@ -15,21 +13,14 @@ set -e
##set -x
${mpiexec:-mpiexec} -n $1 @CMAKE_CURRENT_BINARY_DIR@/eddy_graph $2
# Two titles lines, one with long names, one with short names:
cat >number_eddies.csv <<EOF
"days since 1950-1-1" "number of visible extrema"
days_1950 number_vis_extr
EOF
rm -f isolated_nodes.txt
rank=0
while ((rank < $1))
do
cat number_eddies_$rank.csv >>number_eddies.csv
cat edgelist_$rank.csv >>edgelist_no_header.csv
cat isolated_nodes_$rank.txt >>isolated_nodes.txt
rm number_eddies_$rank.csv edgelist_$rank.csv isolated_nodes_$rank.txt
rm edgelist_$rank.csv isolated_nodes_$rank.txt
((rank += 1))
done
......@@ -44,5 +35,4 @@ $(sort --key=1 --key=2 --numeric-sort edgelist_no_header.csv)
EOF
rm edgelist_no_header.csv
echo "Created files \"number_eddies.csv\", \"edgelist.csv\", " \
"and \"isolated_nodes.txt\"."
echo "Created files \"edgelist.csv\" and \"isolated_nodes.txt\"."
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