local_read_global_logical_array.F90 19.4 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
SUBROUTINE local_read_global_logical_array(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_product_xyz_nodes_real,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_fluid_count_x,global_fluid_count_y,global_fluid_count_z,&
& global_wall_count_x,global_wall_count_y,global_wall_count_z,global_walls_surf_release_plane,&
& My_MPI_Process_ID,divide_x,divide_y,divide_z,IN,OUT,WEST,EAST,UP,DOWN,cartesian_communicator,&
& local_x_min_real,local_x_max_real,local_y_min_real,local_y_max_real,local_z_min_real,local_z_max_real,&
& local_x_nodes_real,local_y_nodes_real,local_z_nodes_real,local_x_nodes_ghost,local_y_nodes_ghost,local_z_nodes_ghost,&
& global_x_min_ghost,global_x_max_ghost,global_y_min_ghost,global_y_max_ghost,global_z_min_ghost,global_z_max_ghost,&
& global_x_nodes_real,global_y_nodes_real,global_z_nodes_real,&
& global_x_nodes_ghost,global_y_nodes_ghost,global_z_nodes_ghost,&
& ROOT,global_walls_count_real,global_fluid_count_real,&
& 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,&
& xyz_dir_normal_to_release_plane,&
& global_plane_dim1_min_real,global_plane_dim1_max_real,&
& global_plane_dim2_min_real,global_plane_dim2_max_real,&
& global_plane_dim3_min_real,global_plane_dim3_max_real,&
& global_plane_dim1_nodes_ghost,&
& global_plane_dim2_nodes_ghost,&
& global_plane_dim3_nodes_ghost,&
& global_plane_dim1_nodes_real,&
& global_plane_dim2_nodes_real,&
& global_plane_dim3_nodes_real,&
& global_fluid_count_xy,&
& global_fluid_count_yz,&
& global_fluid_count_zx,&
& global_wall_count_xy,&
& global_wall_count_yz,&
& global_wall_count_zx,&
& local_walls,&
& filename_number_of_letters,filename)


USE debug_module
USE precision_detector

	IMPLICIT NONE

	INCLUDE "mpif.h"

	INTEGER,INTENT(IN) :: local_x_min_ghost,local_x_max_ghost,local_y_min_ghost,local_y_max_ghost
	INTEGER,INTENT(IN) :: local_z_min_ghost,local_z_max_ghost,global_product_xyz_nodes_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_x_nodes_real,global_y_nodes_real,global_z_nodes_real
	INTEGER,INTENT(IN) :: global_x_nodes_ghost,global_y_nodes_ghost,global_z_nodes_ghost
	INTEGER,INTENT(IN) :: global_x_min_real,global_x_max_real,global_y_min_real,global_y_max_real
	INTEGER,INTENT(IN) :: global_z_min_real,global_z_max_real,filename_number_of_letters,My_MPI_Process_ID
	INTEGER,INTENT(IN) :: IN,OUT,WEST,EAST,UP,DOWN,cartesian_communicator,ROOT
	INTEGER,INTENT(IN) :: local_x_min_real,local_x_max_real,local_y_min_real,local_y_max_real
	INTEGER,INTENT(IN) :: local_z_min_real,local_z_max_real
	INTEGER,INTENT(IN) :: local_x_nodes_ghost,local_y_nodes_ghost,local_z_nodes_ghost
	INTEGER,INTENT(IN) :: local_x_nodes_real,local_y_nodes_real,local_z_nodes_real
	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) :: xyz_dir_normal_to_release_plane
	INTEGER,INTENT(IN) :: global_walls_surf_rel_dim1_min,global_walls_surf_rel_dim1_max

	INTEGER,INTENT(IN) :: global_plane_dim1_min_real,global_plane_dim1_max_real
	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) :: global_plane_dim1_nodes_ghost
	INTEGER,INTENT(IN) :: global_plane_dim2_nodes_ghost
	INTEGER,INTENT(IN) :: global_plane_dim3_nodes_ghost
	INTEGER,INTENT(IN) :: global_plane_dim1_nodes_real 
	INTEGER,INTENT(IN) :: global_plane_dim2_nodes_real 
	INTEGER,INTENT(IN) :: global_plane_dim3_nodes_real 	

	LOGICAL*4,INTENT(IN) :: divide_x,divide_y,divide_z
	LOGICAL*4,PARAMETER :: debug = GLOBAL_DEBUG
	!!LOGICAL*4,PARAMETER :: debug = .true.
	LOGICAL*4,INTENT(INOUT) :: local_walls(local_x_min_ghost:local_x_max_ghost,local_y_min_ghost:local_y_max_ghost,&
	& local_z_min_ghost:local_z_max_ghost)
	LOGICAL*4,INTENT(INOUT) :: global_walls_surf_release_plane(0:1,global_plane_dim2_min_ghost:global_plane_dim2_max_ghost,&
	& global_plane_dim3_min_ghost:global_plane_dim3_max_ghost)
	INTEGER,INTENT(OUT),DIMENSION(global_x_min_real:global_x_max_real) :: global_fluid_count_x
	INTEGER,INTENT(OUT),DIMENSION(global_y_min_real:global_y_max_real) :: global_fluid_count_y
	INTEGER,INTENT(OUT),DIMENSION(global_z_min_real:global_z_max_real) :: global_fluid_count_z

	INTEGER,INTENT(OUT),DIMENSION(global_x_min_real:global_x_max_real,&
	& global_y_min_real:global_y_max_real) :: global_fluid_count_xy
	INTEGER,INTENT(OUT),DIMENSION(global_y_min_real:global_y_max_real,&
	& global_z_min_real:global_z_max_real) :: global_fluid_count_yz
	INTEGER,INTENT(OUT),DIMENSION(global_z_min_real:global_z_max_real,&
	& global_x_min_real:global_x_max_real) :: global_fluid_count_zx

	INTEGER,INTENT(OUT) :: global_walls_count_real,global_fluid_count_real

	INTEGER,INTENT(OUT),DIMENSION(global_x_min_real:global_x_max_real) :: global_wall_count_x
	INTEGER,INTENT(OUT),DIMENSION(global_y_min_real:global_y_max_real) :: global_wall_count_y
	INTEGER,INTENT(OUT),DIMENSION(global_z_min_real:global_z_max_real) :: global_wall_count_z

	INTEGER,INTENT(OUT),DIMENSION(global_x_min_real:global_x_max_real,&
	& global_y_min_real:global_y_max_real) :: global_wall_count_xy
	INTEGER,INTENT(OUT),DIMENSION(global_y_min_real:global_y_max_real,&
	& global_z_min_real:global_z_max_real) :: global_wall_count_yz
	INTEGER,INTENT(OUT),DIMENSION(global_z_min_real:global_z_max_real,&
	& global_x_min_real:global_x_max_real) :: global_wall_count_zx


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

	
	INTEGER :: global_walls_surf_rel_dim1_index
	INTEGER :: global_walls_surf_rel_dim2_index
	INTEGER :: global_walls_surf_rel_dim3_index
	
	INTEGER :: I,J,K,loop_index
	INTEGER :: my_mpi_real_data_type
	LOGICAL*4 :: temporary_store
	CHARACTER(LEN = filename_number_of_letters) filename

	my_mpi_real_data_type = get_my_mpi_real_data_type ()  !FUNNEL OUT THE RESULT OF PRECISION TESTING (this automatically sets the MPI REAL DATA PRECISION TYPE)

!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_x_min_real',global_x_min_real
!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_x_max_real',global_x_max_real
!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_y_min_real',global_y_min_real
!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_y_max_real',global_y_max_real
!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_z_min_real',global_z_min_real
!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'global_z_max_real',global_z_max_real
	
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'is inside local_read_global_logical_array'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'is inside local_read_global_logical_array'


	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 56'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 56'
	OPEN (56, FILE = 'results/'//filename//'.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 56'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 56'



	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to initalize global_fluid_count_x'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to initalize global_fluid_count_x'
				
				global_walls_count_real = 0
				global_fluid_count_real = 0

				global_fluid_count_x(:) = 0
				global_fluid_count_y(:) = 0
				global_fluid_count_z(:) = 0
				
				global_fluid_count_xy(:,:) = 0
				global_fluid_count_yz(:,:) = 0
				global_fluid_count_zx(:,:) = 0


				global_wall_count_x(:) = 0
				global_wall_count_y(:) = 0
				global_wall_count_z(:) = 0

				global_wall_count_xy(:,:) = 0
				global_wall_count_yz(:,:) = 0
				global_wall_count_zx(:,:) = 0


	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished initalizing  global_fluid_count_z'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished initalizing  global_fluid_count_z'
		


		DO loop_index = 1, global_product_xyz_nodes_real
	
			READ(56,*) I,J,K, temporary_store


			!ROTATE I,J,K INDEXES DEPENDING ON ORIENTATION OF THE RELEASE PLANE
			IF(xyz_dir_normal_to_release_plane.EQ.X) THEN !YZ RELEASE PLANE
	
				global_walls_surf_rel_dim1_index = I

				global_walls_surf_rel_dim2_index = J

				global_walls_surf_rel_dim3_index = K


			ELSEIF(xyz_dir_normal_to_release_plane.EQ.Y) THEN !XZ RELEASE PLANE

				global_walls_surf_rel_dim1_index = J

				global_walls_surf_rel_dim2_index = I

				global_walls_surf_rel_dim3_index = K

			ELSEIF(xyz_dir_normal_to_release_plane.EQ.Z) THEN !XY RELEASE PLANE

				global_walls_surf_rel_dim1_index = K

				global_walls_surf_rel_dim2_index = I

				global_walls_surf_rel_dim3_index = J

			ENDIF !!xyz_dir_normal_to_release_plane.EQ. ...
			

			!READ WALLS OR FLUID SURFACE FOR PLANE RELEASE (TWO SLICES,MIN SLICE) 
			IF(global_walls_surf_rel_dim1_index.EQ.global_walls_surf_rel_dim1_min) THEN
			
				global_walls_surf_release_plane(0,global_walls_surf_rel_dim2_index,&
				& global_walls_surf_rel_dim3_index) = temporary_store
			
			ENDIF !!global_walls_surf_rel_dim1_index.EQ.global_walls_surf_rel_dim1_min
			
			!READ WALLS OR FLUID SURFACE FOR PLANE RELEASE (TWO SLICES,MAX SLICE)
			IF(global_walls_surf_rel_dim1_index.EQ.global_walls_surf_rel_dim1_max) THEN
			
				global_walls_surf_release_plane(1,global_walls_surf_rel_dim2_index,&
				& global_walls_surf_rel_dim3_index) = temporary_store

			ENDIF !!global_walls_surf_rel_dim1_index.EQ.global_walls_surf_rel_dim1_max

			IF(.NOT.temporary_store) THEN  !IF FLUID NODE, COUNT IT

				global_fluid_count_real = global_fluid_count_real + 1
				
				global_fluid_count_x(I) = global_fluid_count_x(I) + 1

				global_fluid_count_y(J) = global_fluid_count_y(J) + 1

				global_fluid_count_z(K) = global_fluid_count_z(K) + 1

				global_fluid_count_xy(I,J) = global_fluid_count_xy(I,J) + 1
				
				global_fluid_count_yz(J,K) = global_fluid_count_yz(J,K) + 1
				
				global_fluid_count_zx(K,I) = global_fluid_count_zx(K,I) + 1

			ELSE !WALLS NODE

				global_walls_count_real = global_walls_count_real + 1
				
				global_wall_count_x(I) = global_wall_count_x(I) + 1

				global_wall_count_y(J) = global_wall_count_y(J) + 1

				global_wall_count_z(K) = global_wall_count_z(K) + 1	
				
				global_wall_count_xy(I,J) = global_wall_count_xy(I,J) + 1

				global_wall_count_yz(J,K) = global_wall_count_yz(J,K) + 1

				global_wall_count_zx(K,I) = global_wall_count_zx(K,I) + 1

			ENDIF !!.NOT.temporary_store
			
!			IF(J.EQ.2.AND.K.EQ.1) THEN
!				PRINT*,'temporary_store',temporary_store
!				PRINT*,'I',I
!				PRINT*,'global_fluid_count_yz(J,K)',global_fluid_count_yz(J,K)
!				PRINT*,'global_wall_count_yz(J,K)',global_wall_count_yz(J,K)
!			ENDIF !!

			
			IF(I.GE.local_x_min_real.AND.I.LE.local_x_max_real) THEN  !READ IN THE real AND non-edge real VALUES THAT BELONG TO THIS MPI PROCESS

				IF(J.GE.local_y_min_real.AND.J.LE.local_y_max_real) THEN

					IF(K.GE.local_z_min_real.AND.K.LE.local_z_max_real) THEN
							
						local_walls(I,J,K) = temporary_store
							
					ENDIF !!K

				ENDIF !!J

			ENDIF !!I
	
						
		END DO !!loop_index = 1, local_product_xyz_nodes_real

		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished the reading loop'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished the reading loop'

	CLOSE(56)
	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: CLOSED(56)'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: CLOSED(56)'

!	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished initalizing  global_fluid_count_z'
!	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished initalizing  global_fluid_count_z'



	
	
	IF(My_MPI_Process_ID.EQ.ROOT) THEN


		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 57'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 57'
		OPEN (57, FILE = 'results/'//filename//'_count_x.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 57'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 57'


		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 58'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 58'
		OPEN (58, FILE = 'results/'//filename//'_count_y.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 58'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 58'


		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 59'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 59'
		OPEN (59, FILE = 'results/'//filename//'_count_z.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 59'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 59'

		
		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_x'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_x'

		OPEN (70, FILE = 'results/'//filename//'_inverse_count_x.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		OPEN (71, FILE = 'results/'//filename//'_inverse_count_y.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		OPEN (72, FILE = 'results/'//filename//'_inverse_count_z.txt', STATUS = 'unknown', form='formatted')  !FILE CONTAINING GLOBAL LOGICAL ARRAY
		
		DO I = global_x_min_real,global_x_max_real
		
			WRITE (70,*) I,global_fluid_count_x(I)
			WRITE (57,*) I,global_wall_count_x(I)
						
		END DO !I

		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_x'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_x'

		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_y'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_y'

		DO J = global_y_min_real,global_y_max_real
		
			WRITE (71,*) J,global_fluid_count_y(J)
			WRITE (58,*) J,global_wall_count_y(J)

		END DO	!J

		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_y'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_y'


		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_z'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to WRITE global_fluid_count_z'

		DO K = global_z_min_real,global_z_max_real	
		
			WRITE (72,*) K,global_fluid_count_z(K)
			WRITE (59,*) K,global_wall_count_z(K)

		END DO !K

		IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_z'
		IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished WRITE global_fluid_count_z'


		CLOSE(57)
		CLOSE(58)
		CLOSE(59)

		CLOSE(70)
		CLOSE(71)
		CLOSE(72)

	END IF !!My_MPI_Process_ID.EQ.ROOT


	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to CALL update_ghost_boundaries_logical:local_walls'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to CALL update_ghost_boundaries_logical:local_walls'

	CALL update_ghost_boundaries_logical(local_x_min_ghost,local_x_max_ghost,local_y_min_ghost,local_y_max_ghost,&
	& local_z_min_ghost,local_z_max_ghost,local_x_min_real,local_x_max_real,local_y_min_real,local_y_max_real,local_z_min_real,&
	& local_z_max_real,My_MPI_Process_ID,IN,OUT,WEST,EAST,UP,DOWN,cartesian_communicator,local_x_nodes_ghost,&
	& local_y_nodes_ghost,local_z_nodes_ghost,local_x_nodes_real,local_y_nodes_real,local_z_nodes_real,&
	& divide_x,divide_y,divide_z,local_walls)

	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished CALL update_ghost_boundaries_logical:local_walls'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished CALL update_ghost_boundaries_logical:local_walls'


	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to CALL update_ghost_boundaries_logical:global_walls_surf_release_plane'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to CALL update_ghost_boundaries_logical:global_walls_surf_release_plane'

	CALL update_ghost_boundaries_logical(0,1,global_plane_dim2_min_ghost,&
	& global_plane_dim2_max_ghost,global_plane_dim3_min_ghost,&
	& global_plane_dim3_max_ghost,0,1,global_plane_dim2_min_real,&
	& global_plane_dim2_max_real,global_plane_dim3_min_real,&
	& global_plane_dim3_max_real,My_MPI_Process_ID,IN,&
	& OUT,WEST,EAST,UP,DOWN,cartesian_communicator,2,&
	& global_plane_dim2_nodes_ghost,global_plane_dim3_nodes_ghost,2,&
	& global_plane_dim2_nodes_real,global_plane_dim3_nodes_real,&
	& .FALSE.,.FALSE.,.FALSE.,global_walls_surf_release_plane)

	IF(debug) WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished CALL update_ghost_boundaries_logical:global_walls_surf_release_plane'
	IF(debug) WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished CALL update_ghost_boundaries_logical:global_walls_surf_release_plane'

	IF(debug) THEN  !OUTPUT THE global_walls_surf_release_plane TO A FILE

		WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 56'
		WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: about to open 56'
		OPEN (86, FILE = 'debug/'//filename//'_entrance.txt', STATUS = 'unknown', form='formatted')  
		WRITE (0,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 56'
		WRITE (9,*) My_MPI_Process_ID,'local_read_global_logical_array: finished openning 56'

		DO K = global_plane_dim3_min_ghost,global_plane_dim3_max_ghost
			DO J = global_plane_dim2_min_ghost,global_plane_dim2_max_ghost
				DO I = 0,1

					IF(xyz_dir_normal_to_release_plane.EQ.X) THEN !YZ RELEASE PLANE
	
						WRITE(86,*) I,J,K,global_walls_surf_release_plane(I,J,K)

					ELSEIF(xyz_dir_normal_to_release_plane.EQ.Y) THEN !XZ RELEASE PLANE
	
						WRITE(86,*) J,I,K,global_walls_surf_release_plane(I,J,K)

					ELSEIF(xyz_dir_normal_to_release_plane.EQ.Z) THEN !XY RELEASE PLANE

						WRITE(86,*) J,K,I,global_walls_surf_release_plane(I,J,K)

					ENDIF !!xyz_dir_normal_to_release_plane.EQ. ...

				END DO !I
			END DO	!J
		END DO !K

		CLOSE(86) !! CLOSE (86, FILE = 'debug/'//filename//'_entrance.txt', STATUS = 'unknown', form='formatted')  

	ENDIF !!DEBUG


RETURN
END SUBROUTINE local_read_global_logical_array