A partition is a grid with more information (id, neighbours...) More...
Data Types | |
type | partition |
Public Member Functions | |
subroutine | new_partition (this, i_pos, j_pos, height_var, overlap, zone) |
Default constructor. Id and grid must be set outside. More... | |
subroutine | new_partition_copy (this, other) |
Copy constructor. Here we also copy the grid. More... | |
subroutine | new_partition_from_pos (this, i, j, first_lat, height, width, nb_resized, zone, height_corr) |
Set partition position and the grid. More... | |
subroutine | new_partition_leftover (this, i_pos, j_pos, height, width, n_left, zone) |
Create a grid at position i on the leftover band. Also finishes to set some values. More... | |
logical function | is_idle_partition (this) |
Idle processes are tagged with an id of -2. More... | |
subroutine | init_partition (this, id) |
subroutine | new_mpi_partition (this) |
MPI user-defined datatype from already defined partition, and already defined MPI type for band_grid. More... | |
subroutine | lon_min_leftover_ghost_cells (lon_min, grid, i, width, dlon, nb_lat, first_lat, zone) |
Compute minimal longitude for north and south ghost cells on a leftover band. More... | |
subroutine | find_lon_min_north_ghost_last (lon_min, grid, i, width, dlon, i_lat) |
Compute the minimal longitude for north ghost cells on the leftover band. For that we compute the north neighbour of the west extremity. More... | |
logical function | is_partition_on_boundary (this) |
True if the partition is on the boundary. More... | |
integer function | compute_ghost_cells_direction (this, i, j) |
Store the directions in which there are ghost cells in base 2. More... | |
logical function | is_north_pole (i, this) |
Returns true if the current latitude line is on the north pole. More... | |
logical function | is_south_pole (i, this) |
Returns true if the current latitude line is on the south pole. More... | |
logical function | is_northmost (this) |
Returns true if the current partition is on the northmost band. The partition zone must be set. More... | |
logical function | is_southmost (this) |
Returns true if the current partition is on the southmost band. The partition zone must be set. More... | |
logical function | band_on_northern_hemisphere (i_pos) |
Returns true if the current band is on the northern hemisphere. More... | |
subroutine | new_mpi_borders_partition (this) |
MPI user-defined datatype for 2D advection : we create the interior cells (sent to the adjacent neighbours) and ghost cells (received from neihgbours) The types are defined with the adequate offsets in order to be used directly with the start of the array (so mpi_indexed) The types are actually in the grid, so we call the adequate constructor, while most of the work is done here. More... | |
subroutine | extend_mpi_borders_partition (this) |
Now that all MPI types are created, extend it for all tracer. More... | |
subroutine | create_mpi_borders_partition (this, k, i_neighb, j_start, j_end, direction) |
Create the MPI type corresponding to a border of the current partition : interior or ghost cells. More... | |
subroutine | set_mpi_offset_length_interior_cells (offsets, blocklens, i_start, length, length_prev, nb, this, direction) |
Set the offset and block length for mpi interior cells. Beware, the offset must start from 0. Special cases for east and west as only 1 cell is used for East/West transport but more can be used for North/South. More... | |
subroutine | create_mpi_ghost_cells (this, length, length_prev, k, direction, id, start_prev, end_prev) |
Create the mpi type for the ghost cells (exterior to the grid) We only need the length of the interface. More... | |
subroutine | create_mpi_interior_cells (this, i_start, length, length_prev, k, direction, id) |
Same as create_mpi_ghost_cells but for interior cells. More... | |
subroutine | lon_indices (j_start, j_end, this, k) |
Returns all longitude indices, except for ghost cells at sector boundaries Needs to be in partition_class, as we need to know the position on the band. More... | |
subroutine | set_mpi_offset_length_ghost_cells (offsets, blocklens, length, length_prev, nb, this, direction) |
Set the offset and block length for mpi ghost cells. More... | |
integer function | size_winds_merid (this) |
Size of meridional winds in the partition. We do not have north winds at the north pole, nor south winds at the south pole. We use this occasion to allocate merid_length and set it. More... | |
integer function | nb_winds_merid_lat (i, this) |
Number of meridional winds at latitude i on the current partition An interface is defined between 2 cells, with at least one of them being an interior cell. More... | |
integer function | first_cell_position (i, this) |
Returns the first cell on latitude i, taking into accound the sector borders. More... | |
integer function | first_cell_position_global (i, this) |
Returns the global position for the first cell on latitude i Assumee constant dlon on the same latitude line. More... | |
integer function | first_merid_position_global (i, i_glob, this) |
Get the global position of the first meridion wind. More... | |
integer function | first_interior_cell_position_global (i, this) |
integer function | last_cell_position_global (i, this) |
Returns the global position for the last cell on latitude i. More... | |
integer function | nb_interior_cells_east (i, this) |
Returns the number of interior cells inside sent to east neighbour. More... | |
integer function | nb_interior_cells_west (i, this) |
Returns the number of interior cells inside sent to west neighbour. More... | |
integer function | get_mpi_border (this, side, neighb, direction) |
Accessors for mpi type. Interior or ghost cells are defined by side (0 and 1 respectively). Finding the correct indice inside the array is done by the caller. More... | |
subroutine | new_vector_mpi (blocklength, mpi_type) |
Creates and commit an new vector mpi type for an array of double precision. More... | |
subroutine | send_dimensions_partition (this, id, is_idle) |
Send dimensions for allocatable arrays (of the grid arrays from process 0 to process id) More... | |
subroutine | receive_dimensions_partition (this, id) |
Receive partition dimensions (partition + band_grid) from process id (should be 0 and allocate the corresponding data. More... | |
subroutine | send_partition (this, dest) |
Send the current partition to the process dest. More... | |
subroutine | receive_partition (this, source) |
Receive the partition from process source. More... | |
subroutine | set_pos_partition (this, i, j) |
Set the partition's position in the partitioning matrix. More... | |
subroutine | analytical_winds_partition (this) |
Create winds analytically. More... | |
subroutine | check_data (this) |
subroutine | check_ratio_is_set (this) |
Check all interior cells are initialized. More... | |
subroutine | check_ratio_bounds (part, tracer) |
subroutine | check_ratio_undefined (part, tracer, array) |
subroutine | check_winds_div (this) |
subroutine | starting_winds_indices (k_p, k_n, i_start, this) |
Starting winds indices for previous and next latitudes. Incremented as we go Not the true indice, but updated later. More... | |
subroutine | skip_first_merid_winds (k_n, k_p, i, this) |
Increment meridional winds for the first interior cells. More... | |
subroutine | skip_last_merid_winds (k_n, k_p, i, this) |
Increment meridional winds for skipping last cells. More... | |
subroutine | skip_next_merid_winds (k, i, i_next, dir, this) |
Skip next meridional winds, i.e winds from ghost to interior cells, by incrementing winds indice. More... | |
subroutine | correct_winds (this) |
Correct 2d winds in order to have a null divergence Induces sequential order of operation. More... | |
subroutine | correct_winds_merid (this) |
Correct meridional winds for a divergence null. We want the sum of fluxes on a latitude line to be null. Input : positive merid winds are towards the north. More... | |
subroutine | correct_winds_zonal (this) |
Correct zonal winds such as the sum of fluxes inside a cell is null. Requires meridional winds to be corrected first. More... | |
double precision function | sum_merid_fluxes_cell (i, j, k_p, k_n, this, grid) |
subroutine | set_local_divergence_latitude (cur_div, i_start, i_end, this, grid) |
Compute part of the divergence on the latitude line. More... | |
subroutine | write_concentration (this, id_file, tracer) |
subroutine | write_partition_id (this, id_file) |
subroutine | interpolate_winds_to_south (this, id_file) |
Write the cell winds interpolated at the cell south boundary Format : (u, v, lat, lon) Done here as we need the neighbours. More... | |
subroutine | interpolate_winds_to_center (this, id_file) |
Write the cell winds interpolated at the cell center Format : (u, v, lat, lon) Done here as we need the neighbours. More... | |
double precision function | interpolate_cell_merid_winds_to_south (i, j, k, this) |
Interpolate merid winds of cell at the south border. More... | |
double precision function | interpolate_cell_merid_winds_to_center (i, j, k_p, k_n, this) |
Interpolate merid winds of cells borders into v. More... | |
double precision function | interpolate_cell_zonal_winds_to_center (i, j, k, grid) |
Interpolate zonal winds of cells borders into u. More... | |
subroutine | print_partition (this) |
subroutine | write_center_partitition (this, id_file) |
subroutine | west_neighbours (this, west) |
Gives the west neighbour id >= 1 (-1 if none). This is based on an analytical partitioning. More... | |
integer function | compute_id_from_pos (i, j) |
Compute the id (>= 0) of the partition from its indices (> 0) in the matrix position. More... | |
integer function | compute_zone_from_pos (i, j, nb_parts) |
Recompute the zone from the partition position in the matrix. More... | |
integer function | sector_from_pos (i, j) |
Computes the sector from the position in the matrix array. Used for neighbour computation. More... | |
subroutine | west_partition_wrapper (this, i_west, j_west) |
Compute the west neighbour. Contrary to north-south neighbours, we compute directly the global neighbour. More... | |
subroutine | east_neighbours (this, east) |
Gives the east neighbour id >= 0 (-1 if none). This is based on an analytical partitioning. More... | |
subroutine | east_partition_wrapper (this, i_east, j_east) |
Gives the east neighbour indices inside the position matrix Contrary to north-south neighbours, we compute directly the global neighbour. More... | |
subroutine | north_neighbours (this, id_start, id_end) |
Gives the north neighbours ids >= 0 (-1 if none). This is based on an analytical partitioning. The neighbours are between k_start and k_end. More... | |
integer function | border_indice (this, direction, neighb) |
Gives the indice in the mpi border array. More... | |
subroutine | neighbour_from_direction (neighb, neighb2, this, direction) |
Returns the neighbour according to a integer (0 = north, 3 = west) More... | |
subroutine | north_partition_wrapper (this, i_north, j_start, j_end) |
Wrapper for north_partition_sector. Once we computed the neighbour, we correct the position as the analytical partitioning only gives the neighbours on the first sector. More... | |
subroutine | north_partition_sector (this, i_north, j_start, j_end) |
Find the north neighbour with the indices inside the position matrix The neighbours will range from (i_north, j_start) to (i_north, j_end) Returns the neighbours on the first sector, so you have to correct the results. More... | |
subroutine | correct_neighbours_resized (j_start, j_end, this, pos, j_corr) |
If square partitions have been resized, we must correct the neighbours The integer tell us which digit to use, therefore the direction (1 for north, 2 for south). See the definition of the class for more details. More... | |
integer function | interface_length (this, i_neighb, j_neighb) |
Based on the analytical partitioning, we can find the interface length for the ghost cells of the neighbour of a partition. It computes the starting _indice inside the current grid and the length. To do it analytically avoids to store the list of neighbours. We need the matrix position of the neighbour. We assume there is a neighbour. More... | |
subroutine | interface_interior_cells (i_start, i_length, this, i_neighb, j_neighb) |
Same as interface_length but for interior cells Returns the position of the first cells and the interface length. More... | |
subroutine | width_leftover (width_prev, width, j_pos, nb_cells, nb_parts_band) |
Compute the width of a partition on the last band and the previous width (if last band) All variables refer to the leftover band. More... | |
integer function | width_from_leftover (i_pos) |
From the leftover band, we retrieve the width of the "square" partitions before an eventual resizing. More... | |
subroutine | interface_north_partition (i_start, i_start_loc, i_length, this, j_neighb) |
Find the interface length between a partition and its northern neighbour (for the neighbour). Also returns the first indice of the ghost cells inside the current partition grid. Beware, the second indice is only local (for the corresponding band), while the first correspond to the latitude band Depends entirely of the analytical partitioning Same as south, except that the discussion about the leftover band is on the width, not the left/right neighbour cells. More... | |
subroutine | interface_interior_north_partition (i_start, i_length, this, j_neighb) |
Find the interior interface length between a partition and its northern neighbour (for the neighbour). Also returns the position of the first cell inside the current partition grid. More... | |
subroutine | interface_interior_south_partition (i_start, i_length, this, j_neighb) |
Find the interior interface length between a partition and its southern neighbour Also returns the position of the first cell inside the current partition grid. More... | |
integer function | width_before_resize (this) |
Width of a square partition before the resize. We use the current partition but it works also for the neighbours if we are not on the leftover band. More... | |
integer function | nb_resized_width (i_pos, zone) |
Number of partitions resized in width on the current band from height_var and the latitude position Partitions are resized in height if abs(height_var) >= 1, and resized in width also if abs(height_var) >= 2. More... | |
subroutine | interface_south_partition (i_start, i_start_loc, i_length, this, j_neighb) |
Find the interface length between a partition and its southern neighbour. Also returns the first indice of the ghost cells inside the current partition grid and on the current latitude line . Beware, the indice is only local (for the corresponding band) Depends entirely of the analytical partitioning Same as north, except that the discussion about the leftover band is on the left/right neighbour cells, not the width. More... | |
subroutine | neighbour_extremities (neighb_left, neighb_right, i_neighb, j_neighb, width, this, nb_cells, height_var) |
Compute the extremities for a neighbour partition. More... | |
integer function | leftover_neighbour_extrema_lat (i_neighb, neighb_hemisph) |
Compute the neighbour latitude extrema. Used for computing the leftover width so we need the latitude the furthest from the equator. More... | |
subroutine | partition_extremities (left, right, width, height_var, this, nb_cells, is_top) |
Compute the partition extremities. Also returns width and height var. More... | |
integer function | local_start_interface (left, neighb_left) |
Small function for computing the local starting indice of a neighbour. More... | |
integer function | cast_local_start_interface (left, neighb_left, i, this) |
Cast global indice on the sector to local starting indice. More... | |
integer function | nb_ghost_cells_north (i, j, width, this, dlon) |
Length of the northern ghost cells interface for partition (i,j). Works on northern hemisphere. Idea : the interface is of the same length as the first line with eventually 1 cell at the right and 1 at the left. More... | |
integer function | nb_ghost_cells_south (i, j, width, zone) |
Length of the southern ghost cells interface for partition (i,j) Same idea as north, but easier as we do not deal with the leftover band. More... | |
integer function | interface_south_length_interior_cells_leftover (this, j_neighb) |
Same as interface_north_length_interior_cells_leftover. We cannot factorize it though. More... | |
integer function | width_square_partition (zone) |
Compute the width of a square partition (before resizing) More... | |
subroutine | north_south_partition_from_leftover (this, j_start, j_end, hemisph) |
Gives the neighbours position from the leftover band. On the northern hemisphere, the neighbour is at the north, otherwise at the south. The indice correspond to the position on the previous band and are > 0 Glbal position is done later. More... | |
subroutine | neighbour_info_from_leftover (width_neighb, mid_left, mid_right, mid, nb_cells, nb_cells_neighb, neighb_lat, this, hemisph) |
Computes necessery information for finding north or south partition from leftover. More... | |
integer function | find_partition_from_cell_from_last (this, neighb, mid_left, mid_right, width_neighb, nb_parts_neighb, nb_cells) |
Find the partition containing the cell (all cases). The partition position is given in the latitude band. Works only from a last band and not for a middle part ! More... | |
integer function | leftover_extrema_lat (this, hemisph) |
On northern hemisphere, computes the last latitude line for the north neighbour of the leftover band. On southern hemisphere, computes the first latitude line for the south neighbour of the leftover band. More... | |
subroutine | leftover_nb_parts_cur_neighb (nb_neighb, nb_cur, i_neighb, i_cur) |
Find the number of parts on the current leftover band and on the neighbour band (which must containes square partitions. More... | |
integer function | find_last_band_square_partition_from_cell (j_cell, i, width, zone) |
Find the last band square partition containing the cell. This works for a partition on the other hemisphere. This is an alternative to find_partition_from_cell_from_last as we do not have information on the partition. More... | |
integer function | find_extr_partition_from_cell (this, j_cell, width) |
Find the partition containing the cell (works for only for extremities). Conditions : More... | |
integer function | partition_unmodified_height (this) |
Search the height of an unmodified square partition for north neighbours on last band. More... | |
subroutine | north_south_partition_equator (this, j_start, j_end, i_neighb) |
Gives the north or south neighbours position >= 1 (-1 if none) for a band on one side of the equator, the neighbouring band being on the other side. Works also for leftover partitions. More... | |
integer function | compute_width_leftover (i_neighb, hemisph) |
Re-compute analytically the width of a partition on a leftover band. More... | |
integer function | recompute_leftover_height (hemisph) |
Recomputes analytically the height of the leftover. More... | |
subroutine | north_south_partition_last_square (this, j_start, j_end, hemisph) |
Gives the south neighbours position >= 1 (-1 if none) for the last band containing square partitions on northern hemisphere. Works also for finding north partitions for last square band on southern hemisphere. More... | |
subroutine | left_right_cell_partition (left, right, this, nb_parts, nb_cells, width, is_top) |
Wrapper for left_right_cell. More... | |
subroutine | left_right_cell (left, right, i, j, nb_resized, zone, height_var, nb_parts, nb_cells, width, is_top) |
Finds analytically the position of the left and rightmost cell on the band (before the leftover) for the current partition. For rectangular partitions, left and right are the same for north and south. At the middle, we use a logical to tell us which to choose.. Position is given on the latitude line. Done analytically as it avoids to use floats. Does not need a partition (only 3 integer). We need the width on the current band Does not take ghost cells into account. More... | |
logical function | has_modified_height (i_pos, height_var, zone) |
Returns true if the partitions has been resized in height. Works only for "squared" partitions. More... | |
integer function | find_partition_from_cell_leftover (j_cell, nb_parts_left, width) |
Find in which partition the cell number j_cell is in. Works only for a cell on the leftover partition band. More... | |
subroutine | left_right_cell_partition_leftover (left, right, j, nb_parts, nb_cells, i_lat) |
Finds analytically the position of the left and rightmost cell on the last band. Equivalent of left_right_cell_partition. More... | |
integer function | nb_cells_from_dlon_sector (dlon) |
Numerical way to retrieve the number of cells at latitude line number i for a partition (float operations). Number of cells on a sector. More... | |
logical function | is_right_boundary (j, r, q) |
Tells us if the partition is on the right boundary on a group at the leftover band. More... | |
logical function | is_left_boundary (j, r, q) |
Tells us if the partition is on the left boundary on a group at the leftover band. More... | |
subroutine | get_coef_leftover_last_band (coef, rest, is_even, nb_squares, n_left) |
subroutine | south_neighbours (this, id_start, id_end) |
Gives the south neighbours ids >= 1 (-1 if none). This is based on an analytical partitioning. More... | |
subroutine | south_partition_wrapper (this, i_south, j_start, j_end) |
Wrapper for south_partition_sector. Once we computed the neighbour, we correct the position as the analytical partitioning only gives the neighbours on the first sector. More... | |
subroutine | south_partition_sector (this, i_south, j_start, j_end) |
Gives the south neighbours indices (> 0) in the matrix position This is based on an analytical partitioning. Returns the neighbours on the first sector, so you have to correct the results. More... | |
subroutine | revert_overlap (this) |
Revert north and south for overlap. More... | |
logical function | next_is_leftover_band (i_pos, zone) |
Check if the next partition is on the leftover band in our partitioning. Different from the last band. More... | |
integer function | nb_neighbours_partition (this) |
Computes the number of neighbours for the current partition. More... | |
integer function | nb_north_neighbours (this) |
Computes the number of north neighbours. More... | |
integer function | nb_east_neighbours (this) |
Computes the number of south neighbours. More... | |
integer function | nb_west_neighbours (this) |
Computes the number of south neighbours. More... | |
integer function | nb_south_neighbours (this) |
Computes the number of south neighbours. More... | |
integer function | pseudo_slope_partition (this) |
This "slope" tells us if the first cell on each line goes toward the west (posivite) or the west (negative). Used for computing cells neighbours in tests. We cannot use the first longitude due to float approximation. Slope is always 1, except on last partition on the leftover band. More... | |
subroutine | neighbour_equator (j_start, j_end, i, j2, i_neighb, sector, single, this) |
Cell Neighbour on the other side of the equator. More... | |
subroutine | north_neighbour_cell_partition (j_start, j_end, i, j, this, i_neighb) |
Returns the north neighbours for cells (i,j) inside the partition. Returns only the indice on the previous line. Also works (and include) the ghost cells. The caller must check there is a neighbour. More... | |
subroutine | correct_cell (j, sector, i, this, increase) |
Correct cell position for single partition case. We want to go back to the first sector for the computation and then adjust it. More... | |
subroutine | south_neighbour_cell_partition (j_start, j_end, i, j, this, i_neighb) |
Returns the south neighbours for cells (i,j) inside the partition. Returns only the indice on the previous line. Also includes the ghost cells. The caller must check there is a neighbour. More... | |
logical function | is_latitude_just_before_equator (i, this) |
Returns true if the latitude line i is just before the equator. More... | |
logical function | is_latitude_just_after_equator (i, this) |
Returns true if the latitude line i is just after the equator. More... | |
subroutine | east_neighbour_cell_partition (j_neighb, j) |
Returns the east neighbour for cell (i,j) inside the partition. Returns only the indice on the current line. Also includes the ghost cells. Does not work for cells outside the grid. The caller must check there is a neighbour. More... | |
subroutine | west_neighbour_cell_partition (j_neighb, j) |
Returns the west neighbour for cell (i,j) inside the partition. Returns only the indice on the current line. Also includes the ghost cells. Does not work for cells outside the grid. The caller must check there is a neighbour. More... | |
integer function | nb_neighbours_cell_partition (this, i, j) |
Number of neighbours for the current cell inside the grid. Does not include the ghost cells. More... | |
integer function | nb_neighbours_north_cell_partition (i, j, this) |
Number of north neighbours for the current cell inside the grid. Does not include the ghost cells. More... | |
integer function | nb_neighbours_south_cell_partition (i, j, this) |
Number of south neighbours for the current cell inside the grid. Does not include the ghost cells. More... | |
integer function | get_nb_lon_partition (i, this) |
Returns number of cells at latitude i (in the grid), without the ghost _cells. More... | |
integer function | get_nb_lat_partition (this) |
Returns number of latitudes for the current grid, without the ghost cells. More... | |
integer function | get_true_nb_lat_partition (this) |
Returns number of latitudes for the current grid, with the ghost cells. More... | |
integer function | get_true_nb_lon_partition (i, this) |
Returns number of longitudes for the current grid, with the ghost cells. More... | |
integer function | get_first_lat_partition (this) |
Returns the first latitude for the current grid, without the ghost cells. More... | |
integer function | get_last_lat_partition (this) |
Returns the last latitude for the current grid, without the ghost cells. More... | |
integer function | get_true_last_lat_partition (this) |
Returns the last latitude for the current grid, with the ghost cells. More... | |
integer function | get_first_lon_partition (i, this) |
Returns the first longitude for the current grid, without the ghost cells. More... | |
integer function | get_last_lon_partition (i, this) |
Returns the last longitude for the current grid, without the ghost cells. More... | |
logical function | is_last_on_band_all (this) |
Returns true if the partition is the last on the current band (on all sectors) Works also for 3 partitions. More... | |
logical function | is_first_on_band (this) |
Returns true if the partition is the first on the current band (on a sector) Works also for 3 partitions. More... | |
logical function | is_last_on_band (this) |
Returns true if the partition is the last on the current band (on a sector) Works also for 3 partitions. More... | |
subroutine | check_merid_winds_are_set (this) |
Check all merid winds are initialized. More... | |
subroutine | set_merid_winds_partition (val, k, array, this) |
Set a value for meridional winds at position k in the wind array. More... | |
integer function | nb_cells_partition (this) |
Returns the total number of cells (without ghost cells) More... | |
subroutine | allocate_advection_data (this) |
subroutine | init_requests (this) |
Allocate array of requests once for all neighbours (even though we may use less than all) More... | |
subroutine | free_partition (this) |
subroutine | start_mpi_exchange (this, datatype, zonal, merid) |
Start asynchronous MPI exchange for either zonal or meridional advection. We post sending and receiving requests. For meridional advection, we must exchange with the 4 directions. More... | |
subroutine | start_receive (this, direction, request, l, datatype) |
Receive interior cells from neighbour and store it in ghost cells. Non-blocking. More... | |
subroutine | start_send (this, direction, request, l, datatype) |
Send interior cells to the ghost cells of the neighbour. Non-blocking. More... | |
subroutine | wait_for_all (requests) |
Wait for all requests. We don't use mpi_wait as it will block onto the northmost process (which we want to avoid). Instead, we loop on all and periodically checks each one of them. More... | |
Public Attributes | |
character(*), parameter | fname_partition = "partition_class.F90" |
A partition is a grid with more information (id, neighbours...)
subroutine partition_class::allocate_advection_data | ( | type(partition) | this | ) |
subroutine partition_class::analytical_winds_partition | ( | type(partition) | this | ) |
Create winds analytically.
logical function partition_class::band_on_northern_hemisphere | ( | integer, intent(in) | i_pos | ) |
Returns true if the current band is on the northern hemisphere.
integer function partition_class::border_indice | ( | type(partition) | this, |
integer | direction, | ||
integer | neighb | ||
) |
Gives the indice in the mpi border array.
direction | : an integer from 0 to 3 for north to west |
neighb | : the neighbour, between 1 and the number of neighbours in this direction The call must ensure there is a neighbour. |
integer function partition_class::cast_local_start_interface | ( | integer | left, |
integer | neighb_left, | ||
integer, intent(in) | i, | ||
type (partition) | this | ||
) |
Cast global indice on the sector to local starting indice.
subroutine partition_class::check_data | ( | type (partition) | this | ) |
subroutine partition_class::check_merid_winds_are_set | ( | type(partition) | this | ) |
Check all merid winds are initialized.
subroutine partition_class::check_ratio_bounds | ( | type (partition), target | part, |
integer, intent(in) | tracer | ||
) |
subroutine partition_class::check_ratio_is_set | ( | type (partition) | this | ) |
Check all interior cells are initialized.
subroutine partition_class::check_ratio_undefined | ( | type (partition), target | part, |
integer, intent(in) | tracer, | ||
integer | array | ||
) |
subroutine partition_class::check_winds_div | ( | type(partition), target | this | ) |
integer function partition_class::compute_ghost_cells_direction | ( | type (partition) | this, |
integer | i, | ||
integer | j | ||
) |
Store the directions in which there are ghost cells in base 2.
integer function partition_class::compute_id_from_pos | ( | integer, intent(in) | i, |
integer, intent(in) | j | ||
) |
Compute the id (>= 0) of the partition from its indices (> 0) in the matrix position.
i,j | : partition position in the matrix (in all sectors) |
integer function partition_class::compute_width_leftover | ( | integer, intent(in) | i_neighb, |
integer | hemisph | ||
) |
Re-compute analytically the width of a partition on a leftover band.
i_neighb | : band indice |
hemisph | : hemisphere |
integer function partition_class::compute_zone_from_pos | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | nb_parts | ||
) |
Recompute the zone from the partition position in the matrix.
nb_parts | : number of partitions on band i on a sector |
subroutine partition_class::correct_cell | ( | integer | j, |
integer | sector, | ||
integer, intent(in) | i, | ||
type (partition) | this, | ||
integer, intent(in) | increase | ||
) |
Correct cell position for single partition case. We want to go back to the first sector for the computation and then adjust it.
subroutine partition_class::correct_neighbours_resized | ( | integer | j_start, |
integer | j_end, | ||
type (partition) | this, | ||
integer, intent(in) | pos, | ||
integer, intent(in) | j_corr | ||
) |
If square partitions have been resized, we must correct the neighbours The integer tell us which digit to use, therefore the direction (1 for north, 2 for south). See the definition of the class for more details.
j_corr | : position on the band (first sector only) |
subroutine partition_class::correct_winds | ( | type(partition) | this | ) |
Correct 2d winds in order to have a null divergence Induces sequential order of operation.
subroutine partition_class::correct_winds_merid | ( | type(partition), target | this | ) |
Correct meridional winds for a divergence null. We want the sum of fluxes on a latitude line to be null. Input : positive merid winds are towards the north.
subroutine partition_class::correct_winds_zonal | ( | type(partition), target | this | ) |
Correct zonal winds such as the sum of fluxes inside a cell is null. Requires meridional winds to be corrected first.
subroutine partition_class::create_mpi_borders_partition | ( | type(partition) | this, |
integer | k, | ||
integer | i_neighb, | ||
integer | j_start, | ||
integer | j_end, | ||
integer | direction | ||
) |
Create the MPI type corresponding to a border of the current partition : interior or ghost cells.
subroutine partition_class::create_mpi_ghost_cells | ( | type (partition) | this, |
integer, intent(in) | length, | ||
integer, intent(in) | length_prev, | ||
integer, intent(in) | k, | ||
integer, intent(in) | direction, | ||
integer, intent(in) | id, | ||
integer | start_prev, | ||
integer | end_prev | ||
) |
Create the mpi type for the ghost cells (exterior to the grid) We only need the length of the interface.
direction | integer for the direction 0=north... 3=west |
i_start | : first cell on the current line |
length | : interface length |
length_prev | : sum of all previous interface length |
start_prev | : previous start of the sub array (for check) |
end_prev | : previous end of the sub array(for check) |
subroutine partition_class::create_mpi_interior_cells | ( | type (partition) | this, |
integer, intent(in) | i_start, | ||
integer, intent(in) | length, | ||
integer, intent(in) | length_prev, | ||
integer, intent(in) | k, | ||
integer, intent(in) | direction, | ||
integer, intent(in) | id | ||
) |
Same as create_mpi_ghost_cells but for interior cells.
i_start | : first cell on the current line |
length | : interface length |
length_prev | : sum of all previous interface length |
at_equator | : true if the current line is just before/after the equator, and the ghost cells are on the other side |
subroutine partition_class::east_neighbour_cell_partition | ( | integer | j_neighb, |
integer, intent(in) | j | ||
) |
Returns the east neighbour for cell (i,j) inside the partition. Returns only the indice on the current line. Also includes the ghost cells. Does not work for cells outside the grid. The caller must check there is a neighbour.
subroutine partition_class::east_neighbours | ( | type(partition) | this, |
integer | east | ||
) |
Gives the east neighbour id >= 0 (-1 if none). This is based on an analytical partitioning.
subroutine partition_class::east_partition_wrapper | ( | type(partition) | this, |
integer | i_east, | ||
integer | j_east | ||
) |
Gives the east neighbour indices inside the position matrix Contrary to north-south neighbours, we compute directly the global neighbour.
this | : current partition |
i_east,j_east | : position of the neighbour in the matrix |
subroutine partition_class::extend_mpi_borders_partition | ( | type(partition) | this | ) |
Now that all MPI types are created, extend it for all tracer.
integer function partition_class::find_extr_partition_from_cell | ( | type (partition) | this, |
integer | j_cell, | ||
integer | width | ||
) |
Find the partition containing the cell (works for only for extremities). Conditions :
integer function partition_class::find_last_band_square_partition_from_cell | ( | integer | j_cell, |
integer, intent(in) | i, | ||
integer, intent(in) | width, | ||
integer, intent(in) | zone | ||
) |
Find the last band square partition containing the cell. This works for a partition on the other hemisphere. This is an alternative to find_partition_from_cell_from_last as we do not have information on the partition.
j_cell | : cell number |
i | : band indice |
width | : width of square partition before resize |
subroutine partition_class::find_lon_min_north_ghost_last | ( | double precision, dimension(:) | lon_min, |
type (band_grid) | grid, | ||
integer, intent(in) | i, | ||
integer, intent(in) | width, | ||
double precision, intent(in) | dlon, | ||
integer, intent(in) | i_lat | ||
) |
Compute the minimal longitude for north ghost cells on the leftover band. For that we compute the north neighbour of the west extremity.
integer function partition_class::find_partition_from_cell_from_last | ( | type (partition) | this, |
integer | neighb, | ||
integer | mid_left, | ||
integer | mid_right, | ||
integer | width_neighb, | ||
integer | nb_parts_neighb, | ||
integer | nb_cells | ||
) |
Find the partition containing the cell (all cases). The partition position is given in the latitude band. Works only from a last band and not for a middle part !
mid_left | : left extremity of the middle partition (neighbour band) |
mid_right | : right extremity of the middle partition (neighbour band) |
width_neighb | : width on the neighbour band |
nb_parts_neighb | : number of partitions on neighbour band |
nb_cells | : number of cells on neighbour latitude line |
neighb | : the cell for which we need to know what partition it's in |
integer function partition_class::find_partition_from_cell_leftover | ( | integer, intent(in) | j_cell, |
integer, intent(in) | nb_parts_left, | ||
integer, intent(in) | width | ||
) |
Find in which partition the cell number j_cell is in. Works only for a cell on the leftover partition band.
integer function partition_class::first_cell_position | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns the first cell on latitude i, taking into accound the sector borders.
integer function partition_class::first_cell_position_global | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns the global position for the first cell on latitude i Assumee constant dlon on the same latitude line.
integer function partition_class::first_interior_cell_position_global | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
integer function partition_class::first_merid_position_global | ( | integer, intent(in) | i, |
integer, intent(in) | i_glob, | ||
type (partition) | this | ||
) |
Get the global position of the first meridion wind.
i | : latitude line in the partition |
i_glob | : latitude line in the global grid |
subroutine partition_class::free_partition | ( | type(partition) | this | ) |
subroutine partition_class::get_coef_leftover_last_band | ( | integer | coef, |
integer | rest, | ||
logical, intent(in) | is_even, | ||
integer, intent(in) | nb_squares, | ||
integer, intent(in) | n_left | ||
) |
integer function partition_class::get_first_lat_partition | ( | type (partition) | this | ) |
Returns the first latitude for the current grid, without the ghost cells.
integer function partition_class::get_first_lon_partition | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns the first longitude for the current grid, without the ghost cells.
integer function partition_class::get_last_lat_partition | ( | type (partition) | this | ) |
Returns the last latitude for the current grid, without the ghost cells.
integer function partition_class::get_last_lon_partition | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns the last longitude for the current grid, without the ghost cells.
integer function partition_class::get_mpi_border | ( | type (partition) | this, |
integer | side, | ||
integer | neighb, | ||
integer | direction | ||
) |
Accessors for mpi type. Interior or ghost cells are defined by side (0 and 1 respectively). Finding the correct indice inside the array is done by the caller.
integer function partition_class::get_nb_lat_partition | ( | type (partition) | this | ) |
Returns number of latitudes for the current grid, without the ghost cells.
integer function partition_class::get_nb_lon_partition | ( | integer | i, |
type (partition) | this | ||
) |
Returns number of cells at latitude i (in the grid), without the ghost _cells.
integer function partition_class::get_true_last_lat_partition | ( | type (partition) | this | ) |
Returns the last latitude for the current grid, with the ghost cells.
integer function partition_class::get_true_nb_lat_partition | ( | type (partition) | this | ) |
Returns number of latitudes for the current grid, with the ghost cells.
integer function partition_class::get_true_nb_lon_partition | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns number of longitudes for the current grid, with the ghost cells.
logical function partition_class::has_modified_height | ( | integer, intent(in) | i_pos, |
integer, intent(in) | height_var, | ||
integer, intent(in) | zone | ||
) |
Returns true if the partitions has been resized in height. Works only for "squared" partitions.
i_pos | : current band number |
height_var | : variation of partition height |
zone | : zone indice |
subroutine partition_class::init_partition | ( | type(partition) | this, |
integer | id | ||
) |
subroutine partition_class::init_requests | ( | type (partition) | this | ) |
Allocate array of requests once for all neighbours (even though we may use less than all)
subroutine partition_class::interface_interior_cells | ( | integer | i_start, |
integer | i_length, | ||
type (partition) | this, | ||
integer | i_neighb, | ||
integer | j_neighb | ||
) |
Same as interface_length but for interior cells Returns the position of the first cells and the interface length.
i_neighb,j_neighb | : position in the partition matrix j_neighb will be translated in the first sector |
subroutine partition_class::interface_interior_north_partition | ( | integer | i_start, |
integer | i_length, | ||
type (partition) | this, | ||
integer | j_neighb | ||
) |
Find the interior interface length between a partition and its northern neighbour (for the neighbour). Also returns the position of the first cell inside the current partition grid.
j_neighb | : neighbour column. Can be on any sector, we correct it anyway. |
subroutine partition_class::interface_interior_south_partition | ( | integer | i_start, |
integer | i_length, | ||
type (partition) | this, | ||
integer | j_neighb | ||
) |
Find the interior interface length between a partition and its southern neighbour Also returns the position of the first cell inside the current partition grid.
j_neighb | : neighbour column. Can be on any sector, we correct it anyway. |
integer function partition_class::interface_length | ( | type (partition) | this, |
integer | i_neighb, | ||
integer | j_neighb | ||
) |
Based on the analytical partitioning, we can find the interface length for the ghost cells of the neighbour of a partition. It computes the starting _indice inside the current grid and the length. To do it analytically avoids to store the list of neighbours. We need the matrix position of the neighbour. We assume there is a neighbour.
subroutine partition_class::interface_north_partition | ( | integer | i_start, |
integer | i_start_loc, | ||
integer | i_length, | ||
type (partition) | this, | ||
integer | j_neighb | ||
) |
Find the interface length between a partition and its northern neighbour (for the neighbour). Also returns the first indice of the ghost cells inside the current partition grid. Beware, the second indice is only local (for the corresponding band), while the first correspond to the latitude band Depends entirely of the analytical partitioning Same as south, except that the discussion about the leftover band is on the width, not the left/right neighbour cells.
j_neighb | : neighbour column. Can be on any sector, we correct it anyway. |
integer function partition_class::interface_south_length_interior_cells_leftover | ( | type (partition) | this, |
integer | j_neighb | ||
) |
Same as interface_north_length_interior_cells_leftover. We cannot factorize it though.
subroutine partition_class::interface_south_partition | ( | integer | i_start, |
integer | i_start_loc, | ||
integer | i_length, | ||
type (partition) | this, | ||
integer | j_neighb | ||
) |
Find the interface length between a partition and its southern neighbour. Also returns the first indice of the ghost cells inside the current partition grid and on the current latitude line . Beware, the indice is only local (for the corresponding band) Depends entirely of the analytical partitioning Same as north, except that the discussion about the leftover band is on the left/right neighbour cells, not the width.
j_neighb | : neighbour column. Can be in any sector |
double precision function partition_class::interpolate_cell_merid_winds_to_center | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k_p, | ||
integer | k_n, | ||
type (partition) | this | ||
) |
Interpolate merid winds of cells borders into v.
k_p,k_n | : current position in the meridional winds array of north and south border |
double precision function partition_class::interpolate_cell_merid_winds_to_south | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k, | ||
type (partition) | this | ||
) |
Interpolate merid winds of cell at the south border.
k | : current position in the meridional winds array of south border |
double precision function partition_class::interpolate_cell_zonal_winds_to_center | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k, | ||
type (band_grid) | grid | ||
) |
Interpolate zonal winds of cells borders into u.
k | : current position in the meridional winds array of west border |
subroutine partition_class::interpolate_winds_to_center | ( | type(partition), target | this, |
integer, intent(in) | id_file | ||
) |
Write the cell winds interpolated at the cell center Format : (u, v, lat, lon) Done here as we need the neighbours.
subroutine partition_class::interpolate_winds_to_south | ( | type(partition), target | this, |
integer, intent(in) | id_file | ||
) |
Write the cell winds interpolated at the cell south boundary Format : (u, v, lat, lon) Done here as we need the neighbours.
logical function partition_class::is_first_on_band | ( | type (partition) | this | ) |
Returns true if the partition is the first on the current band (on a sector) Works also for 3 partitions.
logical function partition_class::is_idle_partition | ( | type (partition) | this | ) |
Idle processes are tagged with an id of -2.
logical function partition_class::is_last_on_band | ( | type (partition) | this | ) |
Returns true if the partition is the last on the current band (on a sector) Works also for 3 partitions.
logical function partition_class::is_last_on_band_all | ( | type (partition) | this | ) |
Returns true if the partition is the last on the current band (on all sectors) Works also for 3 partitions.
logical function partition_class::is_latitude_just_after_equator | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns true if the latitude line i is just after the equator.
i | : latitude line inside the partition |
logical function partition_class::is_latitude_just_before_equator | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns true if the latitude line i is just before the equator.
logical function partition_class::is_left_boundary | ( | integer, intent(in) | j, |
integer, intent(in) | r, | ||
integer, intent(in) | q | ||
) |
Tells us if the partition is on the left boundary on a group at the leftover band.
logical function partition_class::is_north_pole | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns true if the current latitude line is on the north pole.
logical function partition_class::is_northmost | ( | type (partition) | this | ) |
Returns true if the current partition is on the northmost band. The partition zone must be set.
logical function partition_class::is_partition_on_boundary | ( | type (partition) | this | ) |
True if the partition is on the boundary.
logical function partition_class::is_right_boundary | ( | integer, intent(in) | j, |
integer, intent(in) | r, | ||
integer, intent(in) | q | ||
) |
Tells us if the partition is on the right boundary on a group at the leftover band.
logical function partition_class::is_south_pole | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns true if the current latitude line is on the south pole.
logical function partition_class::is_southmost | ( | type (partition) | this | ) |
Returns true if the current partition is on the southmost band. The partition zone must be set.
integer function partition_class::last_cell_position_global | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Returns the global position for the last cell on latitude i.
subroutine partition_class::left_right_cell | ( | integer | left, |
integer | right, | ||
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer, intent(in) | nb_resized, | ||
integer, intent(in) | zone, | ||
integer | height_var, | ||
integer | nb_parts, | ||
integer | nb_cells, | ||
integer, intent(in) | width, | ||
logical | is_top | ||
) |
Finds analytically the position of the left and rightmost cell on the band (before the leftover) for the current partition. For rectangular partitions, left and right are the same for north and south. At the middle, we use a logical to tell us which to choose.. Position is given on the latitude line. Done analytically as it avoids to use floats. Does not need a partition (only 3 integer). We need the width on the current band Does not take ghost cells into account.
width | : width of a square partition |
is_top | : true if we want the top of a triangular partition |
nb_parts | : nb of partitions on the current band (only in one sector) |
subroutine partition_class::left_right_cell_partition | ( | integer | left, |
integer | right, | ||
type (partition) | this, | ||
integer | nb_parts, | ||
integer | nb_cells, | ||
integer | width, | ||
logical | is_top | ||
) |
Wrapper for left_right_cell.
subroutine partition_class::left_right_cell_partition_leftover | ( | integer | left, |
integer | right, | ||
integer | j, | ||
integer, intent(in) | nb_parts, | ||
integer, intent(in) | nb_cells, | ||
integer, intent(in) | i_lat | ||
) |
Finds analytically the position of the left and rightmost cell on the last band. Equivalent of left_right_cell_partition.
nb_cells | : number of cells at the neighbour latitude (or last on south hemisphere) |
i_lat | : latitude at the extrema |
integer function partition_class::leftover_extrema_lat | ( | type (partition) | this, |
integer, intent(in) | hemisph | ||
) |
On northern hemisphere, computes the last latitude line for the north neighbour of the leftover band. On southern hemisphere, computes the first latitude line for the south neighbour of the leftover band.
subroutine partition_class::leftover_nb_parts_cur_neighb | ( | integer, intent(out) | nb_neighb, |
integer, intent(out) | nb_cur, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | i_cur | ||
) |
Find the number of parts on the current leftover band and on the neighbour band (which must containes square partitions.
integer function partition_class::leftover_neighbour_extrema_lat | ( | integer, intent(in) | i_neighb, |
integer, intent(in) | neighb_hemisph | ||
) |
Compute the neighbour latitude extrema. Used for computing the leftover width so we need the latitude the furthest from the equator.
neighb_hemisph | : hemisphere for the neighbour |
integer function partition_class::local_start_interface | ( | integer | left, |
integer | neighb_left | ||
) |
Small function for computing the local starting indice of a neighbour.
subroutine partition_class::lon_indices | ( | integer | j_start, |
integer | j_end, | ||
type (partition) | this, | ||
integer | k | ||
) |
Returns all longitude indices, except for ghost cells at sector boundaries Needs to be in partition_class, as we need to know the position on the band.
subroutine partition_class::lon_min_leftover_ghost_cells | ( | double precision, dimension(:) | lon_min, |
type (band_grid) | grid, | ||
integer, intent(in) | i, | ||
integer, intent(in) | width, | ||
double precision, dimension(:), intent(in) | dlon, | ||
integer, intent(in) | nb_lat, | ||
integer, intent(in) | first_lat, | ||
integer, intent(in) | zone | ||
) |
Compute minimal longitude for north and south ghost cells on a leftover band.
i | : partition number of the leftover band. |
integer function partition_class::nb_cells_from_dlon_sector | ( | double precision, intent(in) | dlon | ) |
Numerical way to retrieve the number of cells at latitude line number i for a partition (float operations). Number of cells on a sector.
integer function partition_class::nb_cells_partition | ( | type(partition) | this | ) |
Returns the total number of cells (without ghost cells)
integer function partition_class::nb_east_neighbours | ( | type(partition) | this | ) |
Computes the number of south neighbours.
integer function partition_class::nb_ghost_cells_north | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | width, | ||
type (partition) | this, | ||
double precision, intent(in) | dlon | ||
) |
Length of the northern ghost cells interface for partition (i,j). Works on northern hemisphere. Idea : the interface is of the same length as the first line with eventually 1 cell at the right and 1 at the left.
i | : band number of the partition |
j | : position of the partition on the band (must be on the first |
width | : number of cells |
dlon | : variation of longitude |
this | : current partition |
integer function partition_class::nb_ghost_cells_south | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer, intent(in) | width, | ||
integer, intent(in) | zone | ||
) |
Length of the southern ghost cells interface for partition (i,j) Same idea as north, but easier as we do not deal with the leftover band.
i,j | : partition position in the matrix |
zone | : partition zone |
integer function partition_class::nb_interior_cells_east | ( | integer | i, |
type (partition), target | this | ||
) |
Returns the number of interior cells inside sent to east neighbour.
integer function partition_class::nb_interior_cells_west | ( | integer | i, |
type (partition), target | this | ||
) |
Returns the number of interior cells inside sent to west neighbour.
integer function partition_class::nb_neighbours_cell_partition | ( | type(partition), target | this, |
integer, intent(in) | i, | ||
integer, intent(in) | j | ||
) |
Number of neighbours for the current cell inside the grid. Does not include the ghost cells.
i | : latitude line inside the partition |
j | : longitude on the latitude line inside the partition |
integer function partition_class::nb_neighbours_north_cell_partition | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
type(partition), target | this | ||
) |
Number of north neighbours for the current cell inside the grid. Does not include the ghost cells.
i,j | : cell coordinates inside the partition |
integer function partition_class::nb_neighbours_partition | ( | type(partition) | this | ) |
Computes the number of neighbours for the current partition.
integer function partition_class::nb_neighbours_south_cell_partition | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
type(partition), target | this | ||
) |
Number of south neighbours for the current cell inside the grid. Does not include the ghost cells.
i,j | : cell coordinates inside the partition |
integer function partition_class::nb_north_neighbours | ( | type(partition) | this | ) |
Computes the number of north neighbours.
integer function partition_class::nb_resized_width | ( | integer, intent(in) | i_pos, |
integer, intent(in) | zone | ||
) |
Number of partitions resized in width on the current band from height_var and the latitude position Partitions are resized in height if abs(height_var) >= 1, and resized in width also if abs(height_var) >= 2.
zone | : zone indice |
integer function partition_class::nb_south_neighbours | ( | type(partition) | this | ) |
Computes the number of south neighbours.
integer function partition_class::nb_west_neighbours | ( | type(partition) | this | ) |
Computes the number of south neighbours.
integer function partition_class::nb_winds_merid_lat | ( | integer, intent(in) | i, |
type (partition) | this | ||
) |
Number of meridional winds at latitude i on the current partition An interface is defined between 2 cells, with at least one of them being an interior cell.
subroutine partition_class::neighbour_equator | ( | integer | j_start, |
integer | j_end, | ||
integer, intent(in) | i, | ||
integer, intent(in) | j2, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | sector, | ||
logical, intent(in) | single, | ||
type (partition) | this | ||
) |
Cell Neighbour on the other side of the equator.
subroutine partition_class::neighbour_extremities | ( | integer | neighb_left, |
integer | neighb_right, | ||
integer, intent(in) | i_neighb, | ||
integer, intent(in) | j_neighb, | ||
integer | width, | ||
type (partition) | this, | ||
integer, intent(in) | nb_cells, | ||
integer, intent(in) | height_var | ||
) |
Compute the extremities for a neighbour partition.
neighb_left | : left extremity |
neighb_right | : left extremity |
this | : current partition |
i_neighb | : band on which the neighbour partition is |
j_neighb | : position on this band |
nb_cells | : number of cells on the current line (not the neighbour !) |
subroutine partition_class::neighbour_from_direction | ( | integer | neighb, |
integer | neighb2, | ||
type (partition) | this, | ||
integer | direction | ||
) |
Returns the neighbour according to a integer (0 = north, 3 = west)
subroutine partition_class::neighbour_info_from_leftover | ( | integer, intent(out) | width_neighb, |
integer, intent(out) | mid_left, | ||
integer, intent(out) | mid_right, | ||
integer, intent(out) | mid, | ||
integer, intent(out) | nb_cells, | ||
integer, intent(out) | nb_cells_neighb, | ||
integer, intent(in) | neighb_lat, | ||
type (partition) | this, | ||
integer, intent(in) | hemisph | ||
) |
Computes necessery information for finding north or south partition from leftover.
subroutine partition_class::new_mpi_borders_partition | ( | type(partition) | this | ) |
MPI user-defined datatype for 2D advection : we create the interior cells (sent to the adjacent neighbours) and ghost cells (received from neihgbours) The types are defined with the adequate offsets in order to be used directly with the start of the array (so mpi_indexed) The types are actually in the grid, so we call the adequate constructor, while most of the work is done here.
subroutine partition_class::new_mpi_partition | ( | type(partition) | this | ) |
MPI user-defined datatype from already defined partition, and already defined MPI type for band_grid.
subroutine partition_class::new_partition | ( | type(partition) | this, |
integer | i_pos, | ||
integer | j_pos, | ||
integer | height_var, | ||
integer | overlap, | ||
integer | zone | ||
) |
Default constructor. Id and grid must be set outside.
Copy constructor. Here we also copy the grid.
subroutine partition_class::new_partition_from_pos | ( | type (partition) | this, |
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
integer, intent(in) | first_lat, | ||
integer, intent(in) | height, | ||
integer, intent(in) | width, | ||
integer, intent(in) | nb_resized, | ||
integer, intent(in) | zone, | ||
integer, intent(in) | height_corr | ||
) |
Set partition position and the grid.
i | : position in the partition matrix (latitude) |
j | : position in the partition matrix (longitude) |
hemisph | : 1 on northern hemisphere, -1 otherwise |
first_lat | : starting latitude from the closest pole (beware of the minimal latitude) |
nb_resized | : number of resized partition on the current band (only one one half) |
width | : width of a square partition (before resizing) |
subroutine partition_class::new_partition_leftover | ( | type(partition) | this, |
integer, intent(in) | i_pos, | ||
integer, intent(in) | j_pos, | ||
integer | height, | ||
integer, intent(in) | width, | ||
integer | n_left, | ||
integer, intent(in) | zone | ||
) |
Create a grid at position i on the leftover band. Also finishes to set some values.
height | : partition height |
width | : partition width (except for the last one) |
j_pos | : partition number on the band (no need to correct it) |
i_pos | : partition band |
n_left | : number of partitions on the band |
zone | : zone indice |
subroutine partition_class::new_vector_mpi | ( | integer | blocklength, |
integer | mpi_type | ||
) |
Creates and commit an new vector mpi type for an array of double precision.
logical function partition_class::next_is_leftover_band | ( | integer, intent(in) | i_pos, |
integer, intent(in) | zone | ||
) |
Check if the next partition is on the leftover band in our partitioning. Different from the last band.
i_pos | : band indice |
zone | : zone indice |
subroutine partition_class::north_neighbour_cell_partition | ( | integer | j_start, |
integer | j_end, | ||
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
type (partition) | this, | ||
integer, intent(in), optional | i_neighb | ||
) |
Returns the north neighbours for cells (i,j) inside the partition. Returns only the indice on the previous line. Also works (and include) the ghost cells. The caller must check there is a neighbour.
i | : latitude line inside the partition |
j | : cell position on the latitude line inside the partition |
subroutine partition_class::north_neighbours | ( | type(partition) | this, |
integer | id_start, | ||
integer | id_end | ||
) |
Gives the north neighbours ids >= 0 (-1 if none). This is based on an analytical partitioning. The neighbours are between k_start and k_end.
subroutine partition_class::north_partition_sector | ( | type(partition) | this, |
integer | i_north, | ||
integer | j_start, | ||
integer | j_end | ||
) |
Find the north neighbour with the indices inside the position matrix The neighbours will range from (i_north, j_start) to (i_north, j_end) Returns the neighbours on the first sector, so you have to correct the results.
subroutine partition_class::north_partition_wrapper | ( | type(partition) | this, |
integer | i_north, | ||
integer | j_start, | ||
integer | j_end | ||
) |
Wrapper for north_partition_sector. Once we computed the neighbour, we correct the position as the analytical partitioning only gives the neighbours on the first sector.
subroutine partition_class::north_south_partition_equator | ( | type(partition), target | this, |
integer | j_start, | ||
integer | j_end, | ||
integer, intent(in) | i_neighb | ||
) |
Gives the north or south neighbours position >= 1 (-1 if none) for a band on one side of the equator, the neighbouring band being on the other side. Works also for leftover partitions.
i_neighb | : band containing the neighbour partition |
subroutine partition_class::north_south_partition_from_leftover | ( | type(partition) | this, |
integer | j_start, | ||
integer | j_end, | ||
integer, intent(in) | hemisph | ||
) |
Gives the neighbours position from the leftover band. On the northern hemisphere, the neighbour is at the north, otherwise at the south. The indice correspond to the position on the previous band and are > 0 Glbal position is done later.
hemisph | : positive on the northern hemisphere, otherwise negative. |
subroutine partition_class::north_south_partition_last_square | ( | type(partition), target | this, |
integer | j_start, | ||
integer | j_end, | ||
integer, intent(in) | hemisph | ||
) |
Gives the south neighbours position >= 1 (-1 if none) for the last band containing square partitions on northern hemisphere. Works also for finding north partitions for last square band on southern hemisphere.
subroutine partition_class::partition_extremities | ( | integer | left, |
integer | right, | ||
integer | width, | ||
integer | height_var, | ||
type (partition) | this, | ||
integer, intent(in) | nb_cells, | ||
logical, intent(in) | is_top | ||
) |
Compute the partition extremities. Also returns width and height var.
left[inout] | : left extremity (cell number) |
right[inout] | : right extremity (cell number) |
width[inout] | : width of the partition |
height_var[inout] | : height_var of the partition |
is_top | : select the top or bottom for middle partition |
integer function partition_class::partition_unmodified_height | ( | type (partition) | this | ) |
Search the height of an unmodified square partition for north neighbours on last band.
subroutine partition_class::print_partition | ( | type(partition) | this | ) |
integer function partition_class::pseudo_slope_partition | ( | type (partition) | this | ) |
This "slope" tells us if the first cell on each line goes toward the west (posivite) or the west (negative). Used for computing cells neighbours in tests. We cannot use the first longitude due to float approximation. Slope is always 1, except on last partition on the leftover band.
subroutine partition_class::receive_dimensions_partition | ( | type(partition), target | this, |
integer | id | ||
) |
Receive partition dimensions (partition + band_grid) from process id (should be 0 and allocate the corresponding data.
subroutine partition_class::receive_partition | ( | type (partition) | this, |
integer | source | ||
) |
Receive the partition from process source.
source | : sending process |
integer function partition_class::recompute_leftover_height | ( | integer, intent(in) | hemisph | ) |
Recomputes analytically the height of the leftover.
subroutine partition_class::revert_overlap | ( | type (partition) | this | ) |
Revert north and south for overlap.
integer function partition_class::sector_from_pos | ( | integer, intent(in) | i, |
integer, intent(in) | j | ||
) |
Computes the sector from the position in the matrix array. Used for neighbour computation.
subroutine partition_class::send_dimensions_partition | ( | type(partition), target | this, |
integer | id, | ||
logical, intent(in) | is_idle | ||
) |
Send dimensions for allocatable arrays (of the grid arrays from process 0 to process id)
id | : id for receiving process |
is_idle | : true if we send to an idle process |
subroutine partition_class::send_partition | ( | type (partition) | this, |
integer | dest | ||
) |
Send the current partition to the process dest.
dest | : target process |
subroutine partition_class::set_local_divergence_latitude | ( | double precision, dimension(:) | cur_div, |
integer, intent(in) | i_start, | ||
integer, intent(in) | i_end, | ||
type (partition) | this, | ||
type (band_grid) | grid | ||
) |
Compute part of the divergence on the latitude line.
cur_div | : array storing the final divergence |
subroutine partition_class::set_merid_winds_partition | ( | double precision | val, |
integer, intent(in) | k, | ||
integer, intent(in) | array, | ||
type(partition) | this | ||
) |
Set a value for meridional winds at position k in the wind array.
subroutine partition_class::set_mpi_offset_length_ghost_cells | ( | integer, dimension(:) | offsets, |
integer, dimension(:) | blocklens, | ||
integer, intent(in) | length, | ||
integer, intent(in) | length_prev, | ||
integer, intent(in) | nb, | ||
type (partition), target | this, | ||
integer, intent(in) | direction | ||
) |
Set the offset and block length for mpi ghost cells.
subroutine partition_class::set_mpi_offset_length_interior_cells | ( | integer, dimension(:) | offsets, |
integer, dimension(:) | blocklens, | ||
integer, intent(in) | i_start, | ||
integer, intent(in) | length, | ||
integer, intent(in) | length_prev, | ||
integer, intent(in) | nb, | ||
type (partition), target | this, | ||
integer, intent(in) | direction | ||
) |
Set the offset and block length for mpi interior cells. Beware, the offset must start from 0. Special cases for east and west as only 1 cell is used for East/West transport but more can be used for North/South.
subroutine partition_class::set_pos_partition | ( | type(partition) | this, |
integer, intent(in) | i, | ||
integer, intent(in) | j | ||
) |
Set the partition's position in the partitioning matrix.
integer function partition_class::size_winds_merid | ( | type (partition) | this | ) |
Size of meridional winds in the partition. We do not have north winds at the north pole, nor south winds at the south pole. We use this occasion to allocate merid_length and set it.
subroutine partition_class::skip_first_merid_winds | ( | integer | k_n, |
integer | k_p, | ||
integer, intent(in) | i, | ||
type (partition) | this | ||
) |
Increment meridional winds for the first interior cells.
subroutine partition_class::skip_last_merid_winds | ( | integer | k_n, |
integer | k_p, | ||
integer, intent(in) | i, | ||
type (partition) | this | ||
) |
Increment meridional winds for skipping last cells.
subroutine partition_class::skip_next_merid_winds | ( | integer | k, |
integer, intent(in) | i, | ||
integer, intent(in) | i_next, | ||
integer, intent(in) | dir, | ||
type (partition) | this | ||
) |
Skip next meridional winds, i.e winds from ghost to interior cells, by incrementing winds indice.
dir | : will skip either east or west section |
i_next | : previous or next latitude |
subroutine partition_class::south_neighbour_cell_partition | ( | integer | j_start, |
integer | j_end, | ||
integer, intent(in) | i, | ||
integer, intent(in) | j, | ||
type (partition) | this, | ||
integer, intent(in), optional | i_neighb | ||
) |
Returns the south neighbours for cells (i,j) inside the partition. Returns only the indice on the previous line. Also includes the ghost cells. The caller must check there is a neighbour.
i_neighb | : optional parameter if we want to specify another neighbour latitude (used in south hemisphere) |
subroutine partition_class::south_neighbours | ( | type(partition) | this, |
integer | id_start, | ||
integer | id_end | ||
) |
Gives the south neighbours ids >= 1 (-1 if none). This is based on an analytical partitioning.
subroutine partition_class::south_partition_sector | ( | type(partition) | this, |
integer | i_south, | ||
integer | j_start, | ||
integer | j_end | ||
) |
Gives the south neighbours indices (> 0) in the matrix position This is based on an analytical partitioning. Returns the neighbours on the first sector, so you have to correct the results.
subroutine partition_class::south_partition_wrapper | ( | type(partition) | this, |
integer | i_south, | ||
integer | j_start, | ||
integer | j_end | ||
) |
Wrapper for south_partition_sector. Once we computed the neighbour, we correct the position as the analytical partitioning only gives the neighbours on the first sector.
subroutine partition_class::start_mpi_exchange | ( | type (partition) | this, |
integer, intent(in) | datatype, | ||
logical, intent(in) | zonal, | ||
logical, intent(in) | merid | ||
) |
Start asynchronous MPI exchange for either zonal or meridional advection. We post sending and receiving requests. For meridional advection, we must exchange with the 4 directions.
datatype | : cell ratio, slope or gradient |
merid | : true for meridional advection |
zonal | : true for zonal advection |
subroutine partition_class::start_receive | ( | type(partition), target | this, |
integer | direction, | ||
integer, dimension(:) | request, | ||
integer | l, | ||
integer, intent(in) | datatype | ||
) |
Receive interior cells from neighbour and store it in ghost cells. Non-blocking.
datatype | : cell ratio, slope or gradient |
direction | : 0 for north, 3 for west |
subroutine partition_class::start_send | ( | type(partition), target | this, |
integer | direction, | ||
integer, dimension(:) | request, | ||
integer | l, | ||
integer, intent(in) | datatype | ||
) |
Send interior cells to the ghost cells of the neighbour. Non-blocking.
datatype | : cell ratio, slope or gradient |
cells | : true for sending cells, false for slope |
subroutine partition_class::starting_winds_indices | ( | integer | k_p, |
integer | k_n, | ||
integer, intent(in) | i_start, | ||
type (partition) | this | ||
) |
Starting winds indices for previous and next latitudes. Incremented as we go Not the true indice, but updated later.
double precision function partition_class::sum_merid_fluxes_cell | ( | integer, intent(in) | i, |
integer, intent(in) | j, | ||
integer | k_p, | ||
integer | k_n, | ||
type (partition) | this, | ||
type (band_grid) | grid | ||
) |
subroutine partition_class::wait_for_all | ( | integer, dimension(:) | requests | ) |
Wait for all requests. We don't use mpi_wait as it will block onto the northmost process (which we want to avoid). Instead, we loop on all and periodically checks each one of them.
subroutine partition_class::west_neighbour_cell_partition | ( | integer | j_neighb, |
integer, intent(in) | j | ||
) |
Returns the west neighbour for cell (i,j) inside the partition. Returns only the indice on the current line. Also includes the ghost cells. Does not work for cells outside the grid. The caller must check there is a neighbour.
subroutine partition_class::west_neighbours | ( | type(partition) | this, |
integer | west | ||
) |
Gives the west neighbour id >= 1 (-1 if none). This is based on an analytical partitioning.
subroutine partition_class::west_partition_wrapper | ( | type(partition) | this, |
integer | i_west, | ||
integer | j_west | ||
) |
Compute the west neighbour. Contrary to north-south neighbours, we compute directly the global neighbour.
this | : current partition |
i_east,j_east | : position of the neighbour in the matrix |
integer function partition_class::width_before_resize | ( | type (partition) | this | ) |
Width of a square partition before the resize. We use the current partition but it works also for the neighbours if we are not on the leftover band.
integer function partition_class::width_from_leftover | ( | integer | i_pos | ) |
From the leftover band, we retrieve the width of the "square" partitions before an eventual resizing.
subroutine partition_class::width_leftover | ( | integer | width_prev, |
integer | width, | ||
integer | j_pos, | ||
integer | nb_cells, | ||
integer | nb_parts_band | ||
) |
Compute the width of a partition on the last band and the previous width (if last band) All variables refer to the leftover band.
integer function partition_class::width_square_partition | ( | integer, intent(in) | zone | ) |
Compute the width of a square partition (before resizing)
subroutine partition_class::write_center_partitition | ( | type(partition) | this, |
integer, intent(in) | id_file | ||
) |
subroutine partition_class::write_concentration | ( | type(partition) | this, |
integer, intent(in) | id_file, | ||
integer, intent(in) | tracer | ||
) |
subroutine partition_class::write_partition_id | ( | type(partition) | this, |
integer, intent(in) | id_file | ||
) |
character(*), parameter partition_class::fname_partition = "partition_class.F90" |