Skip to content
Snippets Groups Projects
Commit 8fde9b1d authored by Frederik Zahle's avatar Frederik Zahle
Browse files

Merge branch 'BoxmeshStagSizeVar' into 'master'

Added option in boxmesh to use a variable block shift size in staggered periodic bc

See merge request !70
parents 2b11efc5 d5d58c31
No related branches found
No related tags found
1 merge request!70Added option in boxmesh to use a variable block shift size in staggered periodic bc
Pipeline #72176 passed
...@@ -55,8 +55,10 @@ class BoxMesh(Domain): ...@@ -55,8 +55,10 @@ class BoxMesh(Domain):
Block size, by default 32 Block size, by default 32
filename : str, optional filename : str, optional
Name of grid, by default 'grid.x3dunf' Name of grid, by default 'grid.x3dunf'
staggered : bool, optional staggered : bool or int, optional
For cyclic BC remapping, by default False If True, cyclic BC remapping is used with 1 block shift.
Default False means no shift. If set to non-zero integer
then a shift size of this number of blocks is applied.
printscreen: printscreen:
Print final grid parameters to screen similar to boxf90 Print final grid parameters to screen similar to boxf90
""" """
...@@ -189,7 +191,7 @@ class BoxMesh(Domain): ...@@ -189,7 +191,7 @@ class BoxMesh(Domain):
self.add_blocks(b_i) self.add_blocks(b_i)
# Add shift (assume z-direction is ground and top) # Add shift (assume z-direction is ground and top)
if self.staggered: if int(self.staggered) != 0:
if nbj > 96: if nbj > 96:
print( print(
"ERROR: the number of blocks in y-dir is", "ERROR: the number of blocks in y-dir is",
...@@ -200,9 +202,7 @@ class BoxMesh(Domain): ...@@ -200,9 +202,7 @@ class BoxMesh(Domain):
for k in range(nbk): for k in range(nbk):
for j in range(nbj): for j in range(nbj):
in_ind = nbj + 1 - j - 1 in_ind = nbj + 1 - j - 1
out_ind = nbj - j - 1 out_ind = ((nbj - j - int(self.staggered) - 1) % nbj) + 1
if out_ind == 0:
out_ind = nbj
in_ind = 501 + in_ind in_ind = 501 + in_ind
out_ind = 501 + out_ind out_ind = 501 + out_ind
in_name = str(k) + "_" + str(j) + "_0" in_name = str(k) + "_" + str(j) + "_0"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment