LST_uniform_plane_marker_release.F90 25.3 KB
Newer Older
Femi Kadri's avatar
Femi Kadri committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448
SUBROUTINE LST_uniform_plane_marker_release(My_MPI_Process_ID,total_number_of_LST_markers,Number_Of_Processes,&
& lattice_dimension,ROOT,cartesian_communicator,initial_LST_marker_old_position_x,initial_LST_marker_old_position_y,&
& initial_LST_marker_old_position_z,divide_x,divide_y,divide_z,local_x_min_ghost,local_x_max_ghost,&
& local_y_min_ghost,local_y_max_ghost,local_z_min_ghost,local_z_max_ghost,&
& global_x_min_real,global_x_max_real,global_y_min_real,global_y_max_real,&
& global_z_min_real,global_z_max_real,global_x_min_ghost,global_x_max_ghost,&
& global_y_min_ghost,global_y_max_ghost,global_z_min_ghost,global_z_max_ghost,&
& local_x_min_real_minus_half,local_y_min_real_minus_half,&
& local_z_min_real_minus_half,local_x_max_real_plus_half,&
& local_y_max_real_plus_half,local_z_max_real_plus_half,&
& My_MPI_Process_ID_Digits,LST_local_walls, &
& LST_global_walls_release_plane,Print_Results_MPI_ID,my_mpi_real_data_type,&
& global_initial_marker_IDs,global_initial_positions_lu,&
& spread_LST_markers_in_a_plane,&
& xyz_dir_normal_to_release_plane,LST_release_plane_position_lu,&
& global_plane_dim2_min_ghost,global_plane_dim2_max_ghost,&
& global_plane_dim3_min_ghost,global_plane_dim3_max_ghost,&
& global_plane_dim2_min_real,global_plane_dim2_max_real,&
& global_plane_dim3_min_real,global_plane_dim3_max_real,&
& global_walls_surf_rel_dim1_min,global_walls_surf_rel_dim1_max,&
& LST_global_fluid_surf_rel_plane )

!THIS SUBROUTINE RELEASES LST MARKERS UNIFORMLY IN A USER SPECIFIED PLANE
!ROOT ALONE HANDLES ALL THIS UNDER THE ASSUMPTION THAT THE PLANE GEOMETRY IS NOT TOO LARGE FOR ITS RAM
!AFTER IT IS DONE, ROOT BROADCASTS THE POSITIONS TO THE REST OF THE PROCESSES

!THE SUBROUTINE IMPOSES TWO SIMPLE CHECKS WHEN PICKING INSERTION SITES AFTER THE RANDOM CANDIDATE INSERTION COORDINATES HAVE BEEN GENERATED
!1) NONE OF THE CLOSEST NEIGHBOR NODES CAN BE A WALL
!2) AT LEAST ONE OF THE NEIGHBORING NODES MUST BE A "SURFACE" 
!(IN CASE OF A NONSURFACE RELEASE WE FOOL IT INTO THINKING THAT ALL FLUID NODES ARE "SURFACE" NODES)

USE random_number_generator
USE debug_module
USE precision_detector

	IMPLICIT NONE

	INCLUDE "mpif.h"

	!-----------INTENT(IN)------------------------------------------
	INTEGER,INTENT(IN) :: My_MPI_Process_ID,total_number_of_LST_markers
	INTEGER,INTENT(IN) :: Number_Of_Processes,lattice_dimension
	INTEGER,INTENT(IN) :: ROOT,cartesian_communicator,My_MPI_Process_ID_Digits

	INTEGER,INTENT(IN) :: local_x_min_ghost,local_x_max_ghost
	INTEGER,INTENT(IN) :: local_y_min_ghost,local_y_max_ghost
	INTEGER,INTENT(IN) :: local_z_min_ghost,local_z_max_ghost
	INTEGER,INTENT(IN) :: global_x_min_real,global_x_max_real
	INTEGER,INTENT(IN) :: global_y_min_real,global_y_max_real
	INTEGER,INTENT(IN) :: global_z_min_real,global_z_max_real
	INTEGER,INTENT(IN) :: global_x_min_ghost,global_x_max_ghost
	INTEGER,INTENT(IN) :: global_y_min_ghost,global_y_max_ghost
	INTEGER,INTENT(IN) :: global_z_min_ghost,global_z_max_ghost

	INTEGER,INTENT(IN) :: global_plane_dim2_min_ghost,global_plane_dim2_max_ghost
	INTEGER,INTENT(IN) :: global_plane_dim3_min_ghost,global_plane_dim3_max_ghost
	INTEGER,INTENT(IN) :: global_plane_dim2_min_real,global_plane_dim2_max_real
	INTEGER,INTENT(IN) :: global_plane_dim3_min_real,global_plane_dim3_max_real



	INTEGER,INTENT(IN) :: my_mpi_real_data_type 
	INTEGER,INTENT(IN) :: xyz_dir_normal_to_release_plane
	INTEGER,INTENT(IN) :: global_walls_surf_rel_dim1_min,global_walls_surf_rel_dim1_max


	REAL,INTENT(IN) :: LST_release_plane_position_lu
	REAL,INTENT(IN) :: initial_LST_marker_old_position_x
	REAL,INTENT(IN) :: initial_LST_marker_old_position_y
	REAL,INTENT(IN) :: initial_LST_marker_old_position_z
	REAL,INTENT(IN) :: local_x_min_real_minus_half,local_x_max_real_plus_half
	REAL,INTENT(IN) :: local_y_min_real_minus_half,local_y_max_real_plus_half
	REAL,INTENT(IN) :: local_z_min_real_minus_half,local_z_max_real_plus_half

	REAL :: global_dim1_min_real_minus_half,global_dim1_max_real_plus_half
	REAL :: global_dim2_min_real,global_dim2_max_real
	REAL :: global_dim3_min_real,global_dim3_max_real

	LOGICAL,INTENT(IN) :: divide_x,divide_y,divide_z
	LOGICAL,INTENT(IN) :: spread_LST_markers_in_a_plane 
	LOGICAL*4,INTENT(IN),DIMENSION(local_x_min_ghost:local_x_max_ghost,local_y_min_ghost:local_y_max_ghost,&
	& local_z_min_ghost:local_z_max_ghost) :: LST_local_walls

	LOGICAL*4,INTENT(IN),DIMENSION(0:1,global_plane_dim2_min_ghost:global_plane_dim2_max_ghost,&
	& global_plane_dim3_min_ghost:global_plane_dim3_max_ghost) :: LST_global_walls_release_plane,&
	& LST_global_fluid_surf_rel_plane

	LOGICAL*4,PARAMETER :: debug = GLOBAL_DEBUG
	!-----------INTENT(OUT)------------------------------------------

!	INTEGER,INTENT(OUT) :: local_number_of_LST_markers
!	INTEGER,DIMENSION(0:2 * Number_Of_Processes-1) :: all_local_LST_marker_ID_bounds
!	INTEGER,INTENT(OUT) :: global_initial_marker_IDs(total_number_of_LST_markers)
	!-----------INTENT(INOUT)------------------------------------------
	INTEGER,INTENT(INOUT) :: global_initial_marker_IDs(total_number_of_LST_markers)
	
	REAL,INTENT(INOUT) :: global_initial_positions_lu(lattice_dimension * total_number_of_LST_markers)

	!-----------NO INTENT------------------------------------------

!	INTEGER,PARAMETER :: LST_plane_release_dimension = 1
!	INTEGER,PARAMETER :: LST_release_plane_position_lu = 1

	INTEGER,PARAMETER :: x = 1
	INTEGER,PARAMETER :: y = 2
	INTEGER,PARAMETER :: z = 3

	INTEGER,PARAMETER :: local_LST_marker_bds_send_count = 2
	INTEGER,PARAMETER :: ROOT_LST_marker_bds_recv_count = 2
	INTEGER,PARAMETER :: real_send_recv_tag = 9696
	INTEGER,PARAMETER :: integer_send_recv_tag = 6969

	INTEGER,PARAMETER :: num_of_LST_markers_send_count = 1
	!THIS IS THE X POSITION IF MARKERS ARE TO BE RELEASED IN THE ENTRANCE PLANE
!	REAL,PARAMETER :: LST_release_plane_position_lu = 0.5  


!	INTEGER :: LST_marker_loop_counter,LST_marker_loop_index
	INTEGER :: root_global_position_bcast_size
	INTEGER :: status (MPI_STATUS_SIZE)
!	INTEGER :: idate(8)
!    INTEGER :: i,iseed
	INTEGER :: memory_status
	INTEGER,PARAMETER :: memory_success = 0

	INTEGER :: remote_numbr_of_LST_markers_max,remote_numbr_of_LST_markers_min
	INTEGER :: position_start_buffer_location

	INTEGER :: send_size_integer_buffer,recv_size_integer_buffer
	INTEGER :: send_size_real_buffer,recv_size_real_buffer

	INTEGER,DIMENSION(0:2 * Number_Of_Processes-1) :: all_local_LST_marker_ID_bounds
	INTEGER :: local_number_of_LST_markers_min,local_number_of_LST_markers_max

	INTEGER :: successful_init_position_count,LST_marker_insertion_site_number
	INTEGER :: LST_marker_surface_site_number
	INTEGER :: mpi_abort_error
	INTEGER :: LST_marker_loop_counter,LST_marker_loop_index
	INTEGER :: temp1,temp2,temp3,temp4,temp5,temp6,temp7,temp8,temp9,temp10,temp11,temp12,temp13
	INTEGER :: vertex000_dim1,vertex100_dim1,vertex010_dim1,vertex001_dim1
	INTEGER :: vertex101_dim1,vertex011_dim1,vertex110_dim1,vertex111_dim1
	INTEGER :: vertex000_dim2,vertex100_dim2,vertex010_dim2,vertex001_dim2
	INTEGER :: vertex101_dim2,vertex011_dim2,vertex110_dim2,vertex111_dim2
	INTEGER :: vertex000_dim3,vertex100_dim3,vertex010_dim3,vertex001_dim3
	INTEGER :: vertex101_dim3,vertex011_dim3,vertex110_dim3,vertex111_dim3
	INTEGER :: mpi_error_code,mpi_send_destination,SOURCE,mpi_process_number
!	INTEGER :: global_number_of_LST_markers

	INTEGER,DIMENSION(2) :: send_buffer_local_bounds

	REAL :: random_LST_marker_old_pos_dim1,random_LST_marker_old_pos_dim2,random_LST_marker_old_pos_dim3
	REAL :: global_dim1_real_domain_length,global_dim2_real_domain_length,global_dim3_real_domain_length

	LOGICAL*4,DIMENSION(0:1,global_plane_dim2_min_ghost:global_plane_dim2_max_ghost,&
	& global_plane_dim3_min_ghost:global_plane_dim3_max_ghost) :: global_walls_release_plane_mask


	CHARACTER(LEN = My_MPI_Process_ID_Digits) Print_Results_MPI_ID

	IF(debug) WRITE (0,*) My_MPI_Process_ID,'entered SUBROUTINE LST_uniform_plane_marker_release'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'entered SUBROUTINE LST_uniform_plane_marker_release'

	
	IF(My_MPI_Process_ID.EQ.ROOT) THEN
		
		global_walls_release_plane_mask(:,:,:) = .NOT.LST_global_walls_release_plane(:,:,:)

		LST_marker_insertion_site_number = COUNT(global_walls_release_plane_mask)

		LST_marker_surface_site_number = COUNT(LST_global_fluid_surf_rel_plane)

		!CHECK TO MAKE SURE THAT THERE ARE INSERTION SITES AVAILABLE
		IF(LST_marker_insertion_site_number.EQ.0.OR.LST_marker_surface_site_number.EQ.0) THEN
		
			PRINT*,'LST_uniform_plane_marker_release ERROR: THE PLANE SPECIFIED BY USER DOES NOT CONTAIN ANY INSERTION SITES FOR LST MARKERS!'
			IF(debug) WRITE (0,*) 'LST_uniform_plane_marker_release ERROR: THE PLANE SPECIFIED BY USER DOES NOT CONTAIN ANY INSERTION SITES FOR LST MARKERS!'
			IF(debug) WRITE (9,*) 'LST_uniform_plane_marker_release ERROR: THE PLANE SPECIFIED BY USER DOES NOT CONTAIN ANY INSERTION SITES FOR LST MARKERS!'
			CALL MPI_Abort(cartesian_communicator,mpi_abort_error,mpi_error_code)
			STOP

		ENDIF !! SUM(LST_global_walls_release_plane,LST_global_walls_release_plane.EQ..FALSE.).EQ.0

		IF(xyz_dir_normal_to_release_plane.EQ.X) THEN
		!SELECT APPROPRIATE BOUNDS depending on orientation of release plane
	
			global_dim2_min_real = global_y_min_real
			global_dim2_max_real = global_y_max_real

			global_dim3_min_real = global_z_min_real
			global_dim3_max_real = global_z_max_real

		ELSEIF(xyz_dir_normal_to_release_plane.EQ.Y) THEN

			global_dim2_min_real = global_x_min_real
			global_dim2_max_real = global_x_max_real
	
			global_dim3_min_real = global_z_min_real
			global_dim3_max_real = global_z_max_real

	
		ELSEIF(xyz_dir_normal_to_release_plane.EQ.Z) THEN

			global_dim2_min_real = global_x_min_real
			global_dim2_max_real = global_x_max_real

			global_dim3_min_real = global_y_min_real
			global_dim3_max_real = global_y_max_real

		ELSE
	
				PRINT*,'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
				IF(debug) WRITE (0,*) 'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
				IF(debug) WRITE (9,*) 'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
				STOP

		ENDIF


		!CALCULATE THE LOCAL REAL DOMAIN LENGTH
		global_dim2_real_domain_length = global_dim2_max_real - global_dim2_min_real
		IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: global_dim2_real_domain_length',global_dim2_real_domain_length
		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: global_dim2_real_domain_length',global_dim2_real_domain_length

		global_dim3_real_domain_length = global_dim3_max_real - global_dim3_min_real
		IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: global_dim3_real_domain_length',global_dim3_real_domain_length
		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: global_dim3_real_domain_length',global_dim3_real_domain_length



		successful_init_position_count = 0  !initialize successful_init_position_count

		IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count
		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count

		LST_marker_loop_index = 1
		IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index
		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index


		IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release:  about to DO WHILE'
		IF(debug.AND.My_MPI_Process_ID.EQ.ROOT) WRITE (0,*) 'ROOT LST_uniform_plane_marker_release:  about to DO WHILE'
		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release:  about to DO WHILE'
		
		
		!=====================================START MARKER INSERTION LOOP===============================================

		!DO WHILE (successful_init_position_count.LE.total_number_of_LST_markers)
		DO WHILE (successful_init_position_count.LT.total_number_of_LST_markers)
				
			IF(debug) write(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count  
			IF(debug) write(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count  

			!GENERATE MARKER POSITIONS FROM A UNIFORM DISTRIBUTION, WITHIN THE LOCAL DOMAIN
			random_LST_marker_old_pos_dim1 = LST_release_plane_position_lu
			random_LST_marker_old_pos_dim2 = ( genrand_real1() * global_dim2_real_domain_length ) + global_dim2_min_real
			random_LST_marker_old_pos_dim3 = ( genrand_real1() * global_dim3_real_domain_length ) + global_dim3_min_real

			!THIS SUBROUTINE WILL CALCULAT THE NEIGHBORING LATTICE NODE COORDINATES
			CALL LST_calc_marker_unit_cube_vertex(.FALSE.,.FALSE.,.FALSE.,&
			& vertex000_dim1,vertex100_dim1,vertex010_dim1,vertex001_dim1,vertex101_dim1,vertex011_dim1,&
			& vertex110_dim1,vertex111_dim1,vertex000_dim2,vertex100_dim2,vertex010_dim2,vertex001_dim2,&
			& vertex101_dim2,vertex011_dim2,vertex110_dim2,vertex111_dim2,vertex000_dim3,vertex100_dim3,&
			& vertex010_dim3,vertex001_dim3,vertex101_dim3,vertex011_dim3,vertex110_dim3,vertex111_dim3,&
			& random_LST_marker_old_pos_dim1,random_LST_marker_old_pos_dim2,&
			& random_LST_marker_old_pos_dim3,My_MPI_Process_ID,&
			& global_walls_surf_rel_dim1_min,global_walls_surf_rel_dim1_max,&
			& global_plane_dim2_min_ghost,global_plane_dim2_max_ghost,&
			& global_plane_dim3_min_ghost,global_plane_dim3_max_ghost,&
			& global_walls_surf_rel_dim1_min,global_walls_surf_rel_dim1_max,&
			& global_plane_dim2_min_real,global_plane_dim2_max_real,&
			& global_plane_dim3_min_real,global_plane_dim3_max_real,&
			& 0,1,&
			& global_plane_dim2_min_real,global_plane_dim2_max_real,&
			& global_plane_dim3_min_real,global_plane_dim3_max_real,&
			& cartesian_communicator)
	

			!CHECK TO MAKE SURE THAT THE MARKER IS NOT PLACED INSIDE A WALL IN THE PLANE OF RELEASE, AND
			!ALSO MAKE SURE THAT AT LEAST ONE NEIGHBORING NODE IS A "SURFACE"... IF WE ARE NOT DOING A SURFACE RELEASE,
			!WE FULL IT INTO THINKING THAT ALL FLUID NODES ARE "SURFACE"
			IF( .NOT.( LST_global_walls_release_plane(0,vertex000_dim2,vertex000_dim3).OR.LST_global_walls_release_plane(1,vertex100_dim2,vertex100_dim3).OR.&
			& LST_global_walls_release_plane(0,vertex010_dim2,vertex010_dim3).OR.LST_global_walls_release_plane(0,vertex001_dim2,vertex001_dim3).OR.&
			& LST_global_walls_release_plane(1,vertex101_dim2,vertex101_dim3).OR.LST_global_walls_release_plane(0,vertex011_dim2,vertex011_dim3).OR.&
			& LST_global_walls_release_plane(1,vertex110_dim2,vertex110_dim3).OR.LST_global_walls_release_plane(1,vertex111_dim2,vertex111_dim3) ) .AND.&
			&(LST_global_fluid_surf_rel_plane(0,vertex000_dim2,vertex000_dim3).OR.LST_global_fluid_surf_rel_plane(1,vertex100_dim2,vertex100_dim3).OR.&
			& LST_global_fluid_surf_rel_plane(0,vertex010_dim2,vertex010_dim3).OR.LST_global_fluid_surf_rel_plane(0,vertex001_dim2,vertex001_dim3).OR.&
			& LST_global_fluid_surf_rel_plane(1,vertex101_dim2,vertex101_dim3).OR.LST_global_fluid_surf_rel_plane(0,vertex011_dim2,vertex011_dim3).OR.&
			& LST_global_fluid_surf_rel_plane(1,vertex110_dim2,vertex110_dim3).OR.LST_global_fluid_surf_rel_plane(1,vertex111_dim2,vertex111_dim3) )	) THEN
			
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',0,vertex000_dim2,vertex000_dim3,LST_global_walls_release_plane(0,vertex000_dim2,vertex000_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',1,vertex100_dim2,vertex100_dim3,LST_global_walls_release_plane(1,vertex100_dim2,vertex100_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',0,vertex010_dim2,vertex010_dim3,LST_global_walls_release_plane(0,vertex010_dim2,vertex010_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',0,vertex001_dim2,vertex001_dim3,LST_global_walls_release_plane(0,vertex001_dim2,vertex001_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',1,vertex101_dim2,vertex101_dim3,LST_global_walls_release_plane(1,vertex101_dim2,vertex101_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',0,vertex011_dim2,vertex011_dim3,LST_global_walls_release_plane(0,vertex011_dim2,vertex011_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',1,vertex110_dim2,vertex110_dim3,LST_global_walls_release_plane(1,vertex110_dim2,vertex110_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_walls_release_plane',1,vertex111_dim2,vertex111_dim3,LST_global_walls_release_plane(1,vertex111_dim2,vertex111_dim3)
				

				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',0,vertex000_dim2,vertex000_dim3,LST_global_fluid_surf_rel_plane(0,vertex000_dim2,vertex000_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',1,vertex100_dim2,vertex100_dim3,LST_global_fluid_surf_rel_plane(1,vertex100_dim2,vertex100_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',0,vertex010_dim2,vertex010_dim3,LST_global_fluid_surf_rel_plane(0,vertex010_dim2,vertex010_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',0,vertex001_dim2,vertex001_dim3,LST_global_fluid_surf_rel_plane(0,vertex001_dim2,vertex001_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',1,vertex101_dim2,vertex101_dim3,LST_global_fluid_surf_rel_plane(1,vertex101_dim2,vertex101_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',0,vertex011_dim2,vertex011_dim3,LST_global_fluid_surf_rel_plane(0,vertex011_dim2,vertex011_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',1,vertex110_dim2,vertex110_dim3,LST_global_fluid_surf_rel_plane(1,vertex110_dim2,vertex110_dim3)
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_global_fluid_surf_rel_plane',1,vertex111_dim2,vertex111_dim3,LST_global_fluid_surf_rel_plane(1,vertex111_dim2,vertex111_dim3)




				!LST_global_walls_release_plane(0... is @ global_x_max_real
				!LST_global_walls_release_plane(1... is @ global_x_min_real
				
				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index
				IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index
	
				successful_init_position_count = successful_init_position_count + 1

				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count
				IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: successful_init_position_count',successful_init_position_count


				IF(debug) WRITE(0,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index
				IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_uniform_plane_marker_release: LST_marker_loop_index',LST_marker_loop_index
	
	
	
				global_initial_marker_IDs(successful_init_position_count) = successful_init_position_count

				
				!DEPENDING ON THE ORIENTATION OF THE PLANE WE NEED TO MAP THE COORDINATES TO X,Y,Z
				IF(xyz_dir_normal_to_release_plane.EQ.X) THEN
				
					global_initial_positions_lu(LST_marker_loop_index)      = random_LST_marker_old_pos_dim1
					global_initial_positions_lu(LST_marker_loop_index + 1 ) = random_LST_marker_old_pos_dim2
					global_initial_positions_lu(LST_marker_loop_index + 2 ) = random_LST_marker_old_pos_dim3

				ELSEIF(xyz_dir_normal_to_release_plane.EQ.Y) THEN

					global_initial_positions_lu(LST_marker_loop_index)      = random_LST_marker_old_pos_dim2
					global_initial_positions_lu(LST_marker_loop_index + 1 ) = random_LST_marker_old_pos_dim1
					global_initial_positions_lu(LST_marker_loop_index + 2 ) = random_LST_marker_old_pos_dim3
	

				ELSEIF(xyz_dir_normal_to_release_plane.EQ.Z) THEN
		
					global_initial_positions_lu(LST_marker_loop_index)      = random_LST_marker_old_pos_dim2
					global_initial_positions_lu(LST_marker_loop_index + 1 ) = random_LST_marker_old_pos_dim3
					global_initial_positions_lu(LST_marker_loop_index + 2 ) = random_LST_marker_old_pos_dim1


				ELSE
	
					PRINT*,'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
					IF(debug) WRITE (0,*) 'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
					IF(debug) WRITE (9,*) 'LST_uniform_plane_marker_release ERROR: INVALID xyz_dir_normal_to_release_plane SPECIFIED!'
					STOP

				ENDIF

				LST_marker_loop_index = LST_marker_loop_index + lattice_dimension


			ENDIF !!END CHECK TO MAKE SURE THAT THE MARKER IS NOT PLACED INSIDE A WALL IN THE PLANE OF RELEASE

		END DO !DO WHILE (successful_init_position_count.LE.total_number_of_LST_markers)  
		
		!=====================================END MARKER INSERTION LOOP===============================================

		IF(debug) WRITE(9,*) My_MPI_Process_ID,'LST_initialize_marker_positions: finished to initialize positions'
	



		IF(debug) THEN
		
			OPEN (96, FILE = 'debug/global_initial_positions_lu'//Print_Results_MPI_ID//'.txt', STATUS = 'unknown')

			LST_marker_loop_counter = 0
			DO LST_marker_loop_index = 1, lattice_dimension * total_number_of_LST_markers, lattice_dimension		
			
				LST_marker_loop_counter = LST_marker_loop_counter + 1
						
!					WRITE(96,'(I6.5,3E19.10)') global_initial_marker_IDs(LST_marker_loop_counter), global_initial_positions_lu(LST_marker_loop_index),&
!					& global_initial_positions_lu(LST_marker_loop_index + 1 ),global_initial_positions_lu(LST_marker_loop_index + 2 )

					WRITE(96,'(I6.5,3E19.10)') global_initial_marker_IDs(LST_marker_loop_counter),&
					& global_initial_positions_lu(LST_marker_loop_index ),&
					& global_initial_positions_lu(LST_marker_loop_index + 1 ),&
					& global_initial_positions_lu(LST_marker_loop_index + 2 )
						
			END DO  !!LST_marker_loop_index = 1, lattice_dimension * total_number_of_LST_markers, lattice_dimension		

			CLOSE(96) !!OPEN (96, FILE = 'debug/global_initial_positions_lu'//Print_Results_MPI_ID//'.txt', STATUS = 'unknown')

		ENDIF !!DEBUG

		!------------END ROOT STORES ITS OWN VALUES TO THE global_initial_positions_lu AND TO global_initial_marker_IDs--------------
	
	ENDIF !! My_MPI_Process_ID.EQ.ROOT
	
	!=================================================================
	!ROOT BROADCASTS SUCCESSFUL POSITIONS TO THE REST OF MPI PROCESSES
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  about to CALL MPI_Bcast(global_initial_marker_IDs)'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  about to CALL MPI_Bcast(global_initial_marker_IDs)'
	CALL MPI_Bcast(global_initial_marker_IDs,total_number_of_LST_markers,&
	& MPI_INTEGER,ROOT,cartesian_communicator,mpi_error_code)
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  finished to CALL MPI_Bcast(global_initial_marker_IDs)'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  finished to CALL MPI_Bcast(global_initial_marker_IDs)'


	root_global_position_bcast_size =lattice_dimension * total_number_of_LST_markers

	IF(debug) WRITE (0,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  about to CALL MPI_Bcast(global_initial_positions_lu)'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  about to CALL MPI_Bcast(global_initial_positions_lu)'
	CALL MPI_Bcast(global_initial_positions_lu,root_global_position_bcast_size,&
	& my_mpi_real_data_type,ROOT,cartesian_communicator,mpi_error_code)
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  finished to CALL MPI_Bcast(global_initial_positions_lu)'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'LST_initialize_marker_positions:  finished to CALL MPI_Bcast(global_initial_positions_lu)'
	!==================================================================

	IF(DEBUG) THEN
		OPEN (65, FILE = 'debug/FINAL_LST_global_position_marker_ID_recieve_buffer'//Print_Results_MPI_ID//'.txt', STATUS = 'unknown')

		LST_marker_loop_counter = 0
		DO LST_marker_loop_index = 1, lattice_dimension * total_number_of_LST_markers, lattice_dimension
		
			LST_marker_loop_counter = LST_marker_loop_counter + 1
					
			WRITE(65,'(I6.5,3E19.10)') global_initial_marker_IDs(LST_marker_loop_counter),&
			& global_initial_positions_lu(LST_marker_loop_index),&
			& global_initial_positions_lu(LST_marker_loop_index + 1 ),&
			& global_initial_positions_lu(LST_marker_loop_index + 2 )
						
		END DO  !!LST_marker_loop_index = 1, lattice_dimension * total_number_of_LST_markers, lattice_dimension

		CLOSE(65) !!OPEN (65, FILE = 'debug/FINAL_LST_global_position_marker_ID_recieve_buffer'//Print_Results_MPI_ID//'.txt', STATUS = 'unknown')

	ENDIF !!DEBUG


	IF(debug) WRITE (0,*) My_MPI_Process_ID,'about to END SUBROUTINE LST_uniform_plane_marker_release'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'about to END SUBROUTINE LST_uniform_plane_marker_release'


RETURN
END SUBROUTINE LST_uniform_plane_marker_release