diff --git a/CMakeLists.txt b/CMakeLists.txt index 2f46ef282c2e00939569619f4fb9c61df07a4131..49dae7804baaa3f77b87126424fd6c2abbb725f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ find_package(Geometry REQUIRED CONFIG) find_package(Numer_Rec_95 REQUIRED CONFIG) find_package(NetCDF REQUIRED) find_package(NetCDF_Fortran REQUIRED) +find_package(EZMPI REQUIRED CONFIG) +find_package(GPC_F REQUIRED CONFIG) find_path(fortrangis_INCLUDE_DIR shapelib.mod REQUIRED) include(ConfigureCompilerFlags) find_package(MPI) diff --git a/Inst_eddies/Tests/CMakeLists.txt b/Inst_eddies/Tests/CMakeLists.txt index c53dba386ec1a8d94f6558b9d4f22c77d416c7a9..bb231977d5bc78b0d8b58e6a1aacc5a785dcd7fd 100644 --- a/Inst_eddies/Tests/CMakeLists.txt +++ b/Inst_eddies/Tests/CMakeLists.txt @@ -102,11 +102,15 @@ add_executable(test_set_max_speed ${CMAKE_SOURCE_DIR}/Common/derived_types.f90 set_max_speed.f90 good_contour.f90 max_speed_contour_ssh.f90 mean_speed.f90 ${CMAKE_SOURCE_DIR}/Common/spher_polyline_area.f90 inside_4.f90 - ${CMAKE_CURRENT_LIST_DIR}/test_set_max_speed.f90) + ${CMAKE_CURRENT_LIST_DIR}/test_set_max_speed.f90 + ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 + ${CMAKE_SOURCE_DIR}/Common/shp_tr_close.f90 + ${CMAKE_SOURCE_DIR}/Common/read_field_indices.f90 + ${CMAKE_SOURCE_DIR}/Common/read_eddy.f90) target_link_libraries(test_set_max_speed geometry numer_rec_95 NetCDF95::netcdf95 shapelib_03 contour_531 jumble nr_util - NetCDF_Fortran::NetCDF_Fortran) + NetCDF_Fortran::NetCDF_Fortran ezmpi gpc_f MPI::MPI_Fortran) target_include_directories(test_set_max_speed PRIVATE ${fortrangis_INCLUDE_DIR}) diff --git a/Inst_eddies/Tests/short_tests.json b/Inst_eddies/Tests/short_tests.json index f7aab3d3bc0426e7f96bdc144c550bce7fb71a71..7f756e637db215c702affc5d530df451ead58998 100644 --- a/Inst_eddies/Tests/short_tests.json +++ b/Inst_eddies/Tests/short_tests.json @@ -219,7 +219,9 @@ "$src_dir/Inst_eddies/Tests/Input/empty_outside_points.csv", "outside_points.csv" ], - "$PWD/Get_1_outerm/SHPC/outermost_contour.*" + "$PWD/Get_1_outerm/SHPC/outermost_contour.*", + "$PWD/Get_1_outerm/SHPC/extremum.*", + "$PWD/Get_1_outerm/SHPC/max_speed_contour.*" ], "title": "Set_max_speed", "command": "$build_dir/Inst_eddies/test_set_max_speed" @@ -230,7 +232,9 @@ ["$src_dir/Inst_eddies/Tests/Input/Region_1/huv_region_1_2006_01_01.nc", "h.nc"], ["$src_dir/Inst_eddies/Tests/Input/Region_1/huv_region_1_2006_01_01.nc", "uv.nc"], "$src_dir/Inst_eddies/Tests/Input/Region_1/outside_points.csv", - "$PWD/Get_1_outerm_noise_2_8/SHPC/outermost_contour.*" + "$PWD/Get_1_outerm_noise_2_8/SHPC/outermost_contour.*", + "$PWD/Get_1_outerm_noise_2_8/SHPC/extremum.*", + "$PWD/Get_1_outerm_noise_2_8/SHPC/max_speed_contour.*" ], "title": "Set_max_speed_noise", "command": "$build_dir/Inst_eddies/test_set_max_speed" diff --git a/Inst_eddies/Tests/test_set_max_speed.f90 b/Inst_eddies/Tests/test_set_max_speed.f90 index 87028f4d8d13aa9e60f5065faf3c525693e26023..18a2a6c23ef77bb21d290c0b5fd90136b15217c8 100644 --- a/Inst_eddies/Tests/test_set_max_speed.f90 +++ b/Inst_eddies/Tests/test_set_max_speed.f90 @@ -4,23 +4,26 @@ program test_set_max_speed ! Libraries: use jumble, only: new_unit, count_lines + use mpi_f08, only: mpi_init, mpi_finalize, MPI_Comm_rank, MPI_Comm_world, & + MPI_Comm_size, mpi_abort use netcdf, only: nf90_nowrite use netcdf95, only: nf95_open, nf95_close, nf95_inq_varid, nf95_get_var, & find_coord, nf95_inquire_dimension use nr_util, only: deg_to_rad, rad_to_deg, pi - use shapelib, only: shpt_polygon, shpfileobject, ftdouble, shpclose, & - shpobject - use shapelib_03, only: shp_open_03, shp_create_03, dbf_add_field_03, & - shp_append_object_03, dbf_write_attribute_03, shp_read_object_03, & - dbf_read_attribute_03 + use shapelib, only: shpt_polygon, shpfileobject, ftdouble, shpclose + use shapelib_03, only: shp_create_03, dbf_add_field_03, & + shp_append_object_03, dbf_write_attribute_03 - use derived_types, only: eddy + use derived_types, only: eddy, shp_tr + use read_eddy_m, only: read_eddy use set_max_speed_m, only: set_max_speed + use shp_tr_close_m, only: shp_tr_close + use shp_tr_open_m, only: shp_tr_open implicit none integer ncid, varid, dimid - integer nlon, nlat, unit, n, l + integer nlon, nlat, unit, n, l, d, i, rank, n_proc real, allocatable:: ssh(:, :) ! (nlon, nlat) sea-surface height, in m real, allocatable:: u(:, :), v(:, :) ! (nlon, nlat) wind, in m s-1 type(eddy) e @@ -29,20 +32,26 @@ program test_set_max_speed ! indices of the target extremum, relative to corner real corner(2) + TYPE(shp_tr) hshp_in TYPE(shpfileobject) hshp - TYPE(shpobject) psobject integer ifield, ishape - logical:: cyclone = .true. - real:: ssh_extremum = 0.2759 - real:: coord_extr(2) = [9.625, - 33.875] real, allocatable:: outside_points(:, :) ! (2, :) longitude and ! latitude, in rad, of all the extrema except the target extremum - namelist /main_nml/ cyclone, ssh_extremum, coord_extr, ind_targ_extr + namelist /main_nml/ ind_targ_extr !---------------------------------------------------------------- + call mpi_init + call MPI_Comm_rank(MPI_Comm_world, rank) + call mpi_comm_size(mpi_comm_world, n_proc) + + if (n_proc /= 1) then + if (rank == 0) print *, "test_set_max_speed: 1 process only" + call mpi_abort(MPI_Comm_world, errorcode = 1) + end if + write(unit = error_unit, nml = main_nml) write(unit = error_unit, fmt = *) "Enter namelist main_nml." read(unit = *, nml = main_nml) @@ -78,20 +87,10 @@ program test_set_max_speed call nf95_close(ncid) - print *, "Reading from shapefile outermost_contour..." - call shp_open_03(hshp, "outermost_contour", "rb") - call shp_read_object_03(hshp, 0, psobject) - call dbf_read_attribute_03(e%out_cont%ssh, hshp, ifield = 0, ishape = 0) - CALL shpclose(hshp) - - e%cyclone = cyclone - e%ssh_extr = ssh_extremum - e%coord_extr = coord_extr * deg_to_rad - e%out_cont%n_points = psobject%nvertices - e%out_cont%closed = .true. - allocate(e%out_cont%points(2, e%out_cont%n_points)) - e%out_cont%points(1, :) = psobject%padfx * deg_to_rad - e%out_cont%points(2, :) = psobject%padfy * deg_to_rad + print *, "Reading from shapefiles..." + call shp_tr_open(hshp_in, shp_tr_dir = ".", rank = 0) + call read_eddy(e, d, i, hshp_in, ishape = 0) + CALL shp_tr_close(hshp_in) print *, "Reading from outside_points.csv..." call new_unit(unit) @@ -137,5 +136,6 @@ program test_set_max_speed CALL shpclose(hshp) print *, 'Created shapefile "test_set_max_speed".' + call mpi_finalize end program test_set_max_speed diff --git a/Overlap/CMakeLists.txt b/Overlap/CMakeLists.txt index b35616178d056cc59e81ea0129691e5127a4b893..23f3c55d97886b8f0fc57ebb0e9f34185fc88df4 100644 --- a/Overlap/CMakeLists.txt +++ b/Overlap/CMakeLists.txt @@ -1,6 +1,3 @@ -find_package(EZMPI REQUIRED CONFIG) -find_package(GPC_F REQUIRED CONFIG) - add_executable(eddy_graph eddy_graph.f90 ${CMAKE_SOURCE_DIR}/Common/shp_tr_open.f90 ${CMAKE_SOURCE_DIR}/Common/shp_tr_create.f90 get_snapshot.f90