5#include <PB3D_macros.h>
23 module procedure conv_1d2nd_1d
25 module procedure conv_1d2nd_2d
27 module procedure conv_1d2nd_3d
29 module procedure conv_1d2nd_4d
31 module procedure conv_1d2nd_6d
33 module procedure conv_1d2nd_7d
38 subroutine conv_1d2nd_1d(var_in,var_out)
41 real(dp),
intent(inout),
allocatable :: var_out(:)
44 if (
allocated(var_out))
deallocate(var_out)
45 allocate(var_out(var_in%tot_i_min(1):var_in%tot_i_max(1)))
46 var_out = reshape(var_in%p,shape(var_out))
47 end subroutine conv_1d2nd_1d
49 subroutine conv_1d2nd_2d(var_in,var_out)
52 real(dp),
intent(inout),
allocatable :: var_out(:,:)
55 if (
allocated(var_out))
deallocate(var_out)
57 &var_in%tot_i_min(1):var_in%tot_i_max(1),&
58 &var_in%tot_i_min(2):var_in%tot_i_max(2)))
59 var_out = reshape(var_in%p,[&
60 &var_in%tot_i_max(1)-var_in%tot_i_min(1)+1,&
61 &var_in%tot_i_max(2)-var_in%tot_i_min(2)+1])
62 end subroutine conv_1d2nd_2d
64 subroutine conv_1d2nd_3d(var_in,var_out)
67 real(dp),
intent(inout),
allocatable :: var_out(:,:,:)
70 if (
allocated(var_out))
deallocate(var_out)
72 &var_in%tot_i_min(1):var_in%tot_i_max(1),&
73 &var_in%tot_i_min(2):var_in%tot_i_max(2),&
74 &var_in%tot_i_min(3):var_in%tot_i_max(3)))
75 var_out = reshape(var_in%p,shape(var_out))
76 end subroutine conv_1d2nd_3d
78 subroutine conv_1d2nd_4d(var_in,var_out)
81 real(dp),
intent(inout),
allocatable :: var_out(:,:,:,:)
84 if (
allocated(var_out))
deallocate(var_out)
86 &var_in%tot_i_min(1):var_in%tot_i_max(1),&
87 &var_in%tot_i_min(2):var_in%tot_i_max(2),&
88 &var_in%tot_i_min(3):var_in%tot_i_max(3),&
89 &var_in%tot_i_min(4):var_in%tot_i_max(4)))
90 var_out = reshape(var_in%p,shape(var_out))
91 end subroutine conv_1d2nd_4d
93 subroutine conv_1d2nd_6d(var_in,var_out)
96 real(dp),
intent(inout),
allocatable :: var_out(:,:,:,:,:,:)
99 if (
allocated(var_out))
deallocate(var_out)
101 &var_in%tot_i_min(1):var_in%tot_i_max(1),&
102 &var_in%tot_i_min(2):var_in%tot_i_max(2),&
103 &var_in%tot_i_min(3):var_in%tot_i_max(3),&
104 &var_in%tot_i_min(4):var_in%tot_i_max(4),&
105 &var_in%tot_i_min(5):var_in%tot_i_max(5),&
106 &var_in%tot_i_min(6):var_in%tot_i_max(6)))
107 var_out = reshape(var_in%p,shape(var_out))
108 end subroutine conv_1d2nd_6d
110 subroutine conv_1d2nd_7d(var_in,var_out)
113 real(dp),
intent(inout),
allocatable :: var_out(:,:,:,:,:,:,:)
116 if (
allocated(var_out))
deallocate(var_out)
118 &var_in%tot_i_min(1):var_in%tot_i_max(1),&
119 &var_in%tot_i_min(2):var_in%tot_i_max(2),&
120 &var_in%tot_i_min(3):var_in%tot_i_max(3),&
121 &var_in%tot_i_min(4):var_in%tot_i_max(4),&
122 &var_in%tot_i_min(5):var_in%tot_i_max(5),&
123 &var_in%tot_i_min(6):var_in%tot_i_max(6),&
124 &var_in%tot_i_min(7):var_in%tot_i_max(7)))
125 var_out = reshape(var_in%p,shape(var_out))
126 end subroutine conv_1d2nd_7d
179 function setup_par_id(grid,rich_lvl_max,rich_lvl_loc,tot_rich,par_lim,&
180 &par_id_mem)
result(par_id)
185 integer,
intent(in) :: rich_lvl_max
186 integer,
intent(in) :: rich_lvl_loc
187 logical,
intent(in),
optional :: tot_rich
188 integer,
intent(in),
optional :: par_lim(2)
189 integer,
intent(inout),
optional :: par_id_mem(2)
196 logical :: tot_rich_loc
197 integer :: par_lim_loc(2)
200 tot_rich_loc = .false.
201 if (
present(tot_rich) .and. rich_lvl_max.gt.1) tot_rich_loc = tot_rich
202 par_lim_loc = [1,grid%n(1)]
203 if (
present(par_lim)) par_lim_loc = par_lim
206 n = par_lim_loc(2)-par_lim_loc(1)+1
207 if (tot_rich_loc)
then
208 if (rich_lvl_loc.eq.1)
then
209 s = 2**(rich_lvl_max-1)
212 s = 2**(rich_lvl_max+1-rich_lvl_loc)
219 par_id(1) = 1 + modulo(p-par_lim_loc(1),s)
220 par_id(2) = n - s + 1 + modulo(p-par_lim_loc(2)-1,s)
224 if (
present(par_id_mem)) par_id_mem = &
225 &1 + (par_lim_loc(1)-1-p+par_id(1:2))/s
235 integer,
intent(in) :: rich_lvl_max
236 logical,
intent(in),
optional :: tot_rich
237 integer :: rich_id(2)
240 rich_id = [rich_lvl_max,rich_lvl_max]
241 if (
present(tot_rich) .and. rich_lvl_max.gt.1)
then
242 if (tot_rich) rich_id = [1,rich_lvl_max]
Converts 1-D to n-D variables.
Variables pertaining to the different grids used.
Variables pertaining to HDF5 and XDMF.
Numerical utilities related to giving output.
Numerical variables used by most other modules.
integer, parameter, public dp
double precision
integer, parameter, public max_name_ln
maximum length of filenames
real(dp), parameter, public pi
integer, parameter, public max_str_ln
maximum length of strings
Numerical utilities related to PB3D operations.
integer function, dimension(2), public setup_rich_id(rich_lvl_max, tot_rich)
Returns richardson id.
integer function, dimension(3), public setup_par_id(grid, rich_lvl_max, rich_lvl_loc, tot_rich, par_lim, par_id_mem)
Setup parallel id.
1D equivalent of multidimensional variables, used for internal HDF5 storage.