Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
lbmpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Markus Holzer
lbmpy
Commits
ff587d4b
Commit
ff587d4b
authored
3 years ago
by
Maja Warlich
Browse files
Options
Downloads
Patches
Plain Diff
Sparse shear flow with periodicity.
parent
f4ab1106
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#34722
failed
3 years ago
Stage: test
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lbmpy/sparse/mapping.py
+9
-8
9 additions, 8 deletions
lbmpy/sparse/mapping.py
lbmpy_tests/simple_shear_flow.ipynb
+81
-7
81 additions, 7 deletions
lbmpy_tests/simple_shear_flow.ipynb
lbmpy_tests/test_sparse_lbm.ipynb
+60
-113
60 additions, 113 deletions
lbmpy_tests/test_sparse_lbm.ipynb
with
150 additions
and
128 deletions
lbmpy/sparse/mapping.py
+
9
−
8
View file @
ff587d4b
...
@@ -57,10 +57,10 @@ class SparseLbMapper:
...
@@ -57,10 +57,10 @@ class SparseLbMapper:
def
fluid_coordinates
(
self
):
def
fluid_coordinates
(
self
):
if
self
.
_dirty
:
if
self
.
_dirty
:
self
.
_assemble
()
self
.
_assemble
()
all_fluid_coordinates
=
self
.
_coordinate_arr
[:
self
.
num_fluid_cells
]
#
all_fluid_coordinates = self._coordinate_arr[:self.num_fluid_cells]
non_ghost_fluid_coord
=
[
f
for
f
in
self
.
_coordinate_arr
[:
self
.
num_fluid_cells
]
if
True
not
in
[(
x_i
==
0
)
or
(
x_i
==
self
.
_flag_arr
.
shape
[
i
]
-
1
)
for
i
,
x_i
in
enumerate
(
f
)]]
#
non_ghost_fluid_coord = [f for f in self._coordinate_arr[:self.num_fluid_cells] if True not in [(x_i == 0) or (x_i == self._flag_arr.shape[i]-1) for i, x_i in enumerate(f)]]
#
return self._coordinate_arr[:self.num_fluid_cells]
return
self
.
_coordinate_arr
[:
self
.
num_fluid_cells
]
return
non_ghost_fluid_coord
#
return non_ghost_fluid_coord
@property
@property
def
num_fluid_cells
(
self
):
def
num_fluid_cells
(
self
):
...
@@ -141,11 +141,11 @@ class SparseLbMapper:
...
@@ -141,11 +141,11 @@ class SparseLbMapper:
continue
continue
for
own_cell_idx
,
cell
in
enumerate
(
self
.
fluid_coordinates
):
for
own_cell_idx
,
cell
in
enumerate
(
self
.
fluid_coordinates
):
inv_neighbor_cell
=
np
.
array
([
cell_i
-
dir_i
for
cell_i
,
dir_i
in
zip
(
cell
,
direction
)])
inv_neighbor_cell
=
np
.
array
([
cell_i
-
dir_i
for
cell_i
,
dir_i
in
zip
(
cell
,
direction
)])
#
at_border = [n_cell_i == 0 or n_cell_i == ds_i+1 for n_cell_i, ds_i in zip(cell, self.domain_size)]
at_border
=
[
n_cell_i
==
0
or
n_cell_i
==
ds_i
+
1
for
n_cell_i
,
ds_i
in
zip
(
cell
,
self
.
domain_size
)]
#print("write:", cell, "read:", inv_neighbor_cell)
#print("write:", cell, "read:", inv_neighbor_cell)
#
if (True in at_border):
if
(
True
in
at_border
):
#
continue
result
.
append
(
pdf_index
(
own_cell_idx
,
direction_idx
,
len
(
self
)))
if
flag_arr
[
tuple
(
inv_neighbor_cell
)]
&
fluid_boundary_mask
:
el
if
flag_arr
[
tuple
(
inv_neighbor_cell
)]
&
fluid_boundary_mask
:
neighbor_cell_idx
=
self
.
cell_idx
(
tuple
(
inv_neighbor_cell
))
neighbor_cell_idx
=
self
.
cell_idx
(
tuple
(
inv_neighbor_cell
))
result
.
append
(
pdf_index
(
neighbor_cell_idx
,
direction_idx
,
len
(
self
)))
result
.
append
(
pdf_index
(
neighbor_cell_idx
,
direction_idx
,
len
(
self
)))
#print("write:", cell, "read:", inv_neighbor_cell, "direction:", direction_idx)
#print("write:", cell, "read:", inv_neighbor_cell, "direction:", direction_idx)
...
@@ -154,6 +154,7 @@ class SparseLbMapper:
...
@@ -154,6 +154,7 @@ class SparseLbMapper:
result
.
append
(
pdf_index
(
own_cell_idx
,
inverse_idx
(
stencil
,
direction_idx
),
len
(
self
)))
result
.
append
(
pdf_index
(
own_cell_idx
,
inverse_idx
(
stencil
,
direction_idx
),
len
(
self
)))
#print("write:", cell, "read:", cell, "direction:", inverse_idx(stencil, direction_idx))
#print("write:", cell, "read:", cell, "direction:", inverse_idx(stencil, direction_idx))
else
:
else
:
print
(
"
HEllooo
"
)
#This is where we end up if inv_neighbor_cell is not fluid/no_slip/ghost cell;
#This is where we end up if inv_neighbor_cell is not fluid/no_slip/ghost cell;
#legacy periodicity handler
#legacy periodicity handler
#print("N is not normal")
#print("N is not normal")
...
...
This diff is collapsed.
Click to expand it.
lbmpy_tests/simple_shear_flow.ipynb
+
81
−
7
View file @
ff587d4b
This diff is collapsed.
Click to expand it.
lbmpy_tests/test_sparse_lbm.ipynb
+
60
−
113
View file @
ff587d4b
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment