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
pycodegen
lbmpy
Commits
b9073ad6
Commit
b9073ad6
authored
2 months ago
by
Philipp Suffa
Browse files
Options
Downloads
Patches
Plain Diff
Fixes error, where psm can not be build with cumulants
parent
ad89e699
No related branches found
No related tags found
1 merge request
!187
Optmizations for kernel generation for the partially saturated cells method
Pipeline
#78837
passed
2 months ago
Stage: pretest
Stage: test
Stage: docs
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/lbmpy/creationfunctions.py
+1
-1
1 addition, 1 deletion
src/lbmpy/creationfunctions.py
src/lbmpy/custom_code_nodes.py
+1
-1
1 addition, 1 deletion
src/lbmpy/custom_code_nodes.py
src/lbmpy/partially_saturated_cells.py
+15
-5
15 additions, 5 deletions
src/lbmpy/partially_saturated_cells.py
with
17 additions
and
7 deletions
src/lbmpy/creationfunctions.py
+
1
−
1
View file @
b9073ad6
...
@@ -890,7 +890,7 @@ def create_psm_update_rule(lbm_config, lbm_optimisation):
...
@@ -890,7 +890,7 @@ def create_psm_update_rule(lbm_config, lbm_optimisation):
for
p
in
range
(
lbm_config
.
psm_config
.
max_particles_per_cell
):
for
p
in
range
(
lbm_config
.
psm_config
.
max_particles_per_cell
):
psm_solid_collision
=
add_psm_solid_collision_to_collision_rule
(
lb_update_rule
,
lbm_config
.
psm_config
,
p
)
psm_solid_collision
=
add_psm_solid_collision_to_collision_rule
(
lb_update_rule
,
lbm_config
,
p
)
psm_update_rule
=
create_lb_update_rule
(
psm_update_rule
=
create_lb_update_rule
(
collision_rule
=
psm_solid_collision
,
lbm_config
=
lbm_config
,
lbm_optimisation
=
lbm_optimisation
)
collision_rule
=
psm_solid_collision
,
lbm_config
=
lbm_config
,
lbm_optimisation
=
lbm_optimisation
)
...
...
This diff is collapsed.
Click to expand it.
src/lbmpy/custom_code_nodes.py
+
1
−
1
View file @
b9073ad6
...
@@ -68,7 +68,7 @@ class LbmWeightInfo(CustomCodeNode):
...
@@ -68,7 +68,7 @@ class LbmWeightInfo(CustomCodeNode):
weights
=
[
f
"
((
{
self
.
weights_symbol
.
dtype
.
c_name
}
)(
{
str
(
w
.
evalf
(
17
))
}
))
"
for
w
in
lb_method
.
weights
]
weights
=
[
f
"
((
{
self
.
weights_symbol
.
dtype
.
c_name
}
)(
{
str
(
w
.
evalf
(
17
))
}
))
"
for
w
in
lb_method
.
weights
]
weights
=
"
,
"
.
join
(
weights
)
weights
=
"
,
"
.
join
(
weights
)
w_sym
=
self
.
weights_symbol
w_sym
=
self
.
weights_symbol
code
=
f
"
const
{
self
.
weights_symbol
.
dtype
.
c_name
}
{
w_sym
.
name
}
[] = {{
{
weights
}
}};
\n
"
code
=
f
"
const
{
self
.
weights_symbol
.
dtype
.
c_name
}
{
w_sym
.
name
}
[] = {{
{
weights
}
}};
\n
"
super
(
LbmWeightInfo
,
self
).
__init__
(
code
,
symbols_read
=
set
(),
symbols_defined
=
{
w_sym
})
super
(
LbmWeightInfo
,
self
).
__init__
(
code
,
symbols_read
=
set
(),
symbols_defined
=
{
w_sym
})
def
weight_of_direction
(
self
,
dir_idx
,
lb_method
=
None
):
def
weight_of_direction
(
self
,
dir_idx
,
lb_method
=
None
):
...
...
This diff is collapsed.
Click to expand it.
src/lbmpy/partially_saturated_cells.py
+
15
−
5
View file @
b9073ad6
import
sympy
as
sp
import
sympy
as
sp
from
dataclasses
import
dataclass
from
dataclasses
import
dataclass
from
lbmpy.enums
import
Method
from
lbmpy.methods.abstractlbmethod
import
LbmCollisionRule
from
lbmpy.methods.abstractlbmethod
import
LbmCollisionRule
from
pystencils
import
Assignment
,
AssignmentCollection
from
pystencils
import
Assignment
,
AssignmentCollection
from
pystencils.field
import
Field
from
pystencils.field
import
Field
...
@@ -111,19 +112,28 @@ def replace_fraction_symbol_with_field(assignments, psm_config):
...
@@ -111,19 +112,28 @@ def replace_fraction_symbol_with_field(assignments, psm_config):
return
new_assignments
return
new_assignments
def
add_psm_solid_collision_to_collision_rule
(
collision_rule
,
ps
m_config
,
particle_per_cell_counter
):
def
add_psm_solid_collision_to_collision_rule
(
collision_rule
,
lb
m_config
,
particle_per_cell_counter
):
method
=
collision_rule
.
method
method
=
collision_rule
.
method
solid_collisions
=
get_psm_solid_collision_term
(
collision_rule
,
psm_config
,
particle_per_cell_counter
)
solid_collisions
=
get_psm_solid_collision_term
(
collision_rule
,
lbm_config
.
psm_config
,
particle_per_cell_counter
)
post_collision_pdf_symbols
=
method
.
post_collision_pdf_symbols
post_collision_pdf_symbols
=
method
.
post_collision_pdf_symbols
assignments
=
[]
assignments
=
[]
for
sc
,
post
in
zip
(
solid_collisions
,
post_collision_pdf_symbols
):
for
sc
,
post
in
zip
(
solid_collisions
,
post_collision_pdf_symbols
):
assignments
.
append
(
Assignment
(
post
,
post
+
sc
))
assignments
.
append
(
Assignment
(
post
,
post
+
sc
))
if
psm_config
.
object_force_field
is
not
None
:
if
lbm_config
.
psm_config
.
object_force_field
is
not
None
:
assignments
+=
get_psm_force_from_solid_collision
(
solid_collisions
,
method
.
stencil
,
assignments
+=
get_psm_force_from_solid_collision
(
solid_collisions
,
method
.
stencil
,
psm_config
.
object_force_field
,
particle_per_cell_counter
)
lbm_config
.
psm_config
.
object_force_field
,
particle_per_cell_counter
)
# exchanging rho with zeroth order moment symbol
if
lbm_config
.
method
in
(
Method
.
CENTRAL_MOMENT
,
Method
.
MONOMIAL_CUMULANT
,
Method
.
CUMULANT
):
new_assignments
=
[]
zeroth_moment_symbol
=
'
m_00
'
if
lbm_config
.
stencil
.
D
==
2
else
'
m_000
'
for
ass
in
assignments
:
new_assignments
.
append
(
ass
.
subs
(
sp
.
Symbol
(
'
rho
'
),
sp
.
Symbol
(
zeroth_moment_symbol
)))
assignments
=
new_assignments
collision_assignments
=
AssignmentCollection
(
assignments
)
collision_assignments
=
AssignmentCollection
(
assignments
)
ac
=
LbmCollisionRule
(
method
,
collision_assignments
,
[],
ac
=
LbmCollisionRule
(
method
,
collision_assignments
,
[],
...
@@ -144,7 +154,7 @@ def replace_by_psm_collision_rule(collision_rule, psm_config):
...
@@ -144,7 +154,7 @@ def replace_by_psm_collision_rule(collision_rule, psm_config):
psm_config
.
object_force_field
,
p
)
psm_config
.
object_force_field
,
p
)
for
i
,
main
in
enumerate
(
collision_rule
.
main_assignments
):
for
i
,
main
in
enumerate
(
collision_rule
.
main_assignments
):
rhs
=
main
.
rhs
rhs
=
main
.
rhs
for
p
in
range
(
psm_config
.
max_particles_per_cell
):
for
p
in
range
(
psm_config
.
max_particles_per_cell
):
rhs
+=
solid_collisions
[
p
][
i
]
rhs
+=
solid_collisions
[
p
][
i
]
collision_assignments
.
append
(
Assignment
(
main
.
lhs
,
rhs
))
collision_assignments
.
append
(
Assignment
(
main
.
lhs
,
rhs
))
...
...
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