9 integer(kind=MPI_ADDRESS_KIND) :: lb
10 integer(kind=MPI_ADDRESS_KIND) :: sizes
23 icomm = mpi_comm_world
26 call mpi_type_get_extent(mpi_real,lb,sizes,
ierrmpi)
27 if (sizes /= size_real)
call mpistop(
"Incompatible real size")
28 call mpi_type_get_extent(mpi_double_precision,lb,sizes,
ierrmpi)
29 if (sizes /= size_double)
call mpistop(
"Incompatible double size")
30 call mpi_type_get_extent(mpi_integer,lb,sizes,
ierrmpi)
31 if (sizes /= size_int)
call mpistop(
"Incompatible integer size")
32 call mpi_type_get_extent(mpi_logical,lb,sizes,
ierrmpi)
33 if (sizes /= size_logical)
call mpistop(
"Incompatible logical size")
41 call mpi_barrier(mpi_comm_world,
ierrmpi)
50 integer,
dimension(ndim+1) :: sizes, subsizes, start
51 integer :: i^D, ic^D, nx^D, nxCo^D, nxG^D, idir
53 nx^d=ixmhi^d-ixmlo^d+1;
59 ^d&subsizes(^d)=nxg^d;
61 ^d&start(^d)=
ixglo^d-1;
63 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
64 mpi_order_fortran,mpi_double_precision, &
71 ^d&subsizes(^d)=nxco^d;
73 ^d&start(^d)=ixmlo^d-1;
75 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
76 mpi_order_fortran,mpi_double_precision, &
81 ^d&sizes(^d)=
ixghi^d+1;
83 ^d&subsizes(^d)=nx^d+1;
85 ^d&start(^d)=ixmlo^d-1;
87 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
88 mpi_order_fortran,mpi_double_precision, &
97 ^d&subsizes(^d)=nxco^d+
kr(ic^d,1)*
kr(idir,^d);
99 ^d&start(^d)=ixmlo^d-
kr(ic^d,1)*
kr(idir,^d);
102 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
103 mpi_order_fortran,mpi_double_precision, &
109 ^d&sizes(^d)=
ixghi^d+1;
113 ^d&subsizes(^d)=nxco^d+
kr(ic^d,1)*
kr(idir,^d);
115 ^d&start(^d)=ixmlo^d-
kr(ic^d,1)*
kr(idir,^d)+(ic^d-1)*nxco^d;
117 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
118 mpi_order_fortran,mpi_double_precision, &
125 ^d&sizes(^d)=
ixghi^d;
128 ^d&subsizes(^d)=nxco^d;
130 ^d&start(^d)=ixmlo^d-1+(ic^d-1)*nxco^d;
132 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
133 mpi_order_fortran,mpi_double_precision, &
138 ^d&sizes(^d)=
ixghi^d;
140 ^d&subsizes(^d)=nx^d;
142 ^d&start(^d)=ixmlo^d-1;
144 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
145 mpi_order_fortran,mpi_double_precision, &
150 ^d&sizes(^d)=ixmhi^d-ixmlo^d+1;
152 ^d&subsizes(^d)=sizes(^d);
156 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
157 mpi_order_fortran,mpi_double_precision, &
161 ^d&sizes(^d)=ixmhi^d-ixmlo^d+2;
163 ^d&subsizes(^d)=sizes(^d);
167 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
168 mpi_order_fortran,mpi_double_precision, &
172 ^d&sizes(^d)=ixmhi^d-ixmlo^d+1;
174 ^d&subsizes(^d)=sizes(^d);
178 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
179 mpi_order_fortran,mpi_double_precision, &
183 ^d&sizes(^d)=ixmhi^d-ixmlo^d+2;
185 ^d&subsizes(^d)=sizes(^d);
189 call mpi_type_create_subarray(
ndim+1,sizes,subsizes,start, &
190 mpi_order_fortran,mpi_double_precision, &
200 character(len=*),
intent(in) :: message
203 write(*, *)
"ERROR for processor",
mype,
":" 204 write(*, *) trim(message)
This module contains definitions of global parameters and variables and some generic functions/subrou...
integer type_block
MPI type for block including ghost cells and its size.
integer type_block_wc_io
MPI type for IO: cell corner (wc) or cell center (wcc) variables.
integer, dimension(^nd, 2^d &) type_sub_block_stg
integer npe
The number of MPI tasks.
integer, parameter ixglo
Lower index of grid block arrays (always 1)
integer nghostcells
Number of ghost cells surrounding a grid.
integer ixghi
Upper index of grid block arrays.
integer type_block_io
MPI type for IO: block excluding ghost cells.
logical stagger_grid
True for using stagger grid.
integer type_block_xcc_io
integer ierrmpi
A global MPI error return code.
integer size_block_io_stg
integer, dimension(3, 3) kr
Kronecker delta tensor.
integer mype
The rank of the current MPI task.
subroutine comm_start
Initialize the MPI environment.
subroutine init_comm_types
Create and store the MPI types that will be used for parallel communication.
subroutine mpistop(message)
Exit MPI-AMRVAC with an error message.
integer, parameter ndim
Number of spatial dimensions for grid variables.
integer, dimension(2^d &) type_sub_block
integer type_block_wcc_io
integer nwauxio
Number of auxiliary variables that are only included in output.
integer icomm
The MPI communicator.
integer type_block_io_stg
MPI type for IO of staggered variables.
integer, dimension(^nd, 2^d &) type_coarse_block_stg
MPI type for staggered block coarsened by 2, and for its children blocks.
integer type_coarse_block
MPI type for block coarsened by 2, and for its children blocks.
subroutine comm_finalize
Finalize (or shutdown) the MPI environment.
integer type_block_xc_io
MPI type for IO: cell corner (xc) or cell center (xcc) coordinates.