Commit 79d546f2 authored by Maja Warlich's avatar Maja Warlich
Browse files

No-slip flip & corners fixed.

parent 554548fc
Pipeline #34015 failed with stage
in 12 minutes and 21 seconds
......@@ -234,14 +234,17 @@ class SparseLbPeriodicityMapper:
continue
read = [(write_i - dir_i)%ds_i for write_i, dir_i, ds_i in zip(write, direction, self.domain_size)]
write_idx = pdf_index(self.cell_idx(tuple(write)), direction_idx, len(self.mapping))
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
if self.flag_arr[tuple(read)] & self.no_slip_flag: # Read cell is no-slip: flip PDF!
#read from write cell, inverse direction
print("write:", write, "read:", write, "bc. no-slip from inv.dir.")
read_idx = pdf_index(write_idx, inverse_idx(stencil, direction_idx), len(self.mapping))
#periodic_idx_array.append([direction_idx, inverse_idx(stencil, direction_idx), write, write]) #nur zu debug Zwecken
else:
print("write:", write, "read:", read)
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
#periodic_idx_array.append([direction_idx, write, read]) #nur zu debug Zwecken
periodic_idx_array.append([direction_idx, write_idx, read_idx])
# "Die Zelle "write" bekommt ihren neuen Wert der jeweiligen direction von der Zelle "read"
print("write:", write, "read:", read)
#periodic_idx_array.append([direction_idx, write, read]) #nur zu debug Zwecken
result.append(tuple(periodic_idx_array))
# inner: wird zwischen benachbarten Zellen *im gleichen Block* geschickt
print("(inner:)")
......@@ -259,13 +262,16 @@ class SparseLbPeriodicityMapper:
continue
read = [write_i - dir_i for write_i, dir_i in zip(write, direction)]
write_idx = pdf_index(self.cell_idx(tuple(write)), direction_idx, len(self.mapping))
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
if self.flag_arr[tuple(read)] & self.no_slip_flag: # Read cell is no-slip: flip PDF!
#read from write cell, inverse direction
print("write:", write, "read:", write, "bc. no-slip from inv.dir.")
read_idx = pdf_index(write_idx, inverse_idx(stencil, direction_idx), len(self.mapping))
#inner_idx_array.append([direction_idx, inverse_idx(stencil, direction_idx), write, write]) #for debug
else:
print("write:", write, "read:", read)
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
#inner_idx_array.append([direction_idx, write, read]) #for debug
inner_idx_array.append([direction_idx, write_idx, read_idx])
print("write:", write, "read:", read)
#inner_idx_array.append([direction_idx, write, read]) #for debug
if direction[pos] == 0: #spricht directions 1, 2, 3 und 4 an
# inner: wird zwischen benachbarte Zellen *im gleichen Block* geschickt
print("(inner:)")
......@@ -282,13 +288,16 @@ class SparseLbPeriodicityMapper:
continue
read = [write_i - dir_i for write_i, dir_i in zip(write, direction)]
write_idx = pdf_index(self.cell_idx(tuple(write)), direction_idx, len(self.mapping))
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
if self.flag_arr[tuple(read)] & self.no_slip_flag: # Read cell is no-slip: flip PDF!
#read from write cell, inverse direction
print("write:", write, "read:", write, "bc. no-slip from inv.dir.")
read_idx = pdf_index(write_idx, inverse_idx(stencil, direction_idx), len(self.mapping))
inner_idx_array.append([direction_idx, write_idx, read_idx])
print("write:", write, "read:", read)
#inner_idx_array.append([direction_idx, write, read]) #for debug
#inner_idx_array.append([direction_idx, inverse_idx(stencil, direction_idx), write, write]) #for debug
else:
print("write:", write, "read:", read)
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
#inner_idx_array.append([direction_idx, write, read]) #for debug
inner_idx_array.append([direction_idx, write, read]) #for debug
#Four corners: extra periodic_idx_array for each direction 5, 6, 7, 8
if (direction[0]*direction[1] != 0):
write = [int((self.domain_size[0]-1)*(1-direction[0])/2),int((self.domain_size[1]-1)*(1-direction[1])/2)]
......@@ -296,14 +305,17 @@ class SparseLbPeriodicityMapper:
continue
read = [(write_i - dir_i)%ds_i for write_i, dir_i, ds_i in zip(write, direction, self.domain_size)]
write_idx = pdf_index(self.cell_idx(tuple(write)), direction_idx, len(self.mapping))
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
if self.flag_arr[tuple(read)] & self.no_slip_flag: # Read cell is no-slip: flip PDF!
#read from write cell, inverse direction
print("(Ecke) write:", write, "read:", write, "bc. no-slip from inv.dir.")
read_idx = pdf_index(write_idx, inverse_idx(stencil, direction_idx), len(self.mapping))
#periodic_idx_array.append([direction_idx, inverse_idx(stencil, direction_idx), write, write]) #nur zu debug Zwecken
else:
print("(Ecke) write:", write, "read:", read)
read_idx = pdf_index(self.cell_idx(tuple(read)), direction_idx, len(self.mapping))
#periodic_idx_array.append([direction_idx, write, read]) #nur zu debug Zwecken
periodic_idx_array.append([direction_idx, write_idx, read_idx])
#periodic_idx_array.append([direction_idx, write, read]) #nur zu debug Zwecken
result.append(tuple(periodic_idx_array))
print("(Ecke) write:", write, "read:", read)
# result enthält *mehrere* index arrays
#result = list(dict.fromkeys(result)) # entferne doppelte index_arrays: speziell Ecken der Domain
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment