49#include "implicit_f.inc"
58 integer,
intent(inout) :: nb_cell_x
59 integer,
intent(inout) :: nb_cell_y
60 integer,
intent(inout) :: nb_cell_z
61 my_real,
dimension(6),
intent(inout) :: box_limit
65 INTEGER :: LEADING_DIMENSION
67 my_real :: ratio,size_cell,dist_max
76 dx_box = abs(box_limit(1) - box_limit(4))
77 dy_box = abs(box_limit(2) - box_limit(5))
78 dz_box = abs(box_limit(3) - box_limit(6))
80 dist_max =
max(dx_box,dy_box,dz_box)
81 IF(dist_max==dx_box) leading_dimension = 1
82 IF(dist_max==dy_box) leading_dimension = 2
83 IF(dist_max==dz_box) leading_dimension = 3
86 ratio = sqrt( numnodg / (dx_box*dy_box+dx_box*dz_box+dy_box*dz_box))
87 IF(leading_dimension==1)
THEN
88 nb_cell_x = nint( ratio * dx_box )
90 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)
94 size_cell = dx_box / nb_cell_x
96 nb_cell_y = nint( dy_box / size_cell )
98 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
102 nb_cell_z = nint( dz_box / size_cell )
104 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
107 ELSEIF(leading_dimension==2)
THEN
108 nb_cell_y = nint( ratio * dy_box )
110 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
114 size_cell = dy_box / nb_cell_y
116 nb_cell_x = nint( dx_box / size_cell )
118 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)
122 nb_cell_z = nint( dz_box / size_cell )
124 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
127 ELSEIF(leading_dimension==3)
THEN
128 nb_cell_z = nint( ratio * dz_box )
130 nb_cell_z = nb_cell_z - modulo(nb_cell_z,4)
134 size_cell = dz_box / nb_cell_z
136 nb_cell_y = nint( dy_box / size_cell )
138 nb_cell_y = nb_cell_y - modulo(nb_cell_y,4)
142 nb_cell_x = nint( dx_box / size_cell )
144 nb_cell_x = nb_cell_x - modulo(nb_cell_x,4)