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
ec6c62ba
Commit
ec6c62ba
authored
4 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Adapted phasefield implementation
parent
14984e2b
No related branches found
No related tags found
1 merge request
!40
Advanced Streaming Extensions
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lbmpy/phasefield_allen_cahn/kernel_equations.py
+13
-15
13 additions, 15 deletions
lbmpy/phasefield_allen_cahn/kernel_equations.py
with
13 additions
and
15 deletions
lbmpy/phasefield_allen_cahn/kernel_equations.py
+
13
−
15
View file @
ec6c62ba
...
...
@@ -320,29 +320,26 @@ def get_update_rules_velocity(src_field, u_in, lb_method, force, density, sub_it
return
update_u
def
get_collision_assignments_hydro
(
density
=
1
,
optimization
=
None
,
sub_iterations
=
2
,
**
kwargs
):
def
get_collision_assignments_hydro
(
lb_method
,
density
,
velocity_input
,
force
,
sub_iterations
,
symbolic_fields
,
kernel_type
):
r
"""
Get collision assignments for the hydrodynamic lattice Boltzmann step. Here the force gets applied in the moment
space. Afterwards the transformation back to the pdf space happens.
Args:
lb_method: moment based lattice Boltzmann method
density: the interpolated density of the simulation
optimization: for details see createfunctions.py
velocity_input: velocity field for the hydrodynamic and Allen-Chan LB step
force: force vector containing a summation of the surface tension-, pressure-, viscous- and bodyforce vector
sub_iterations: number of updates of the velocity field
symbolic_fields: PDF fields for source and destination
kernel_type: collide_stream_push or collide_only
"""
if
optimization
is
None
:
optimization
=
{}
params
,
opt_params
=
update_with_default_parameters
(
kwargs
,
optimization
)
lb_method
=
params
[
'
lb_method
'
]
stencil
=
lb_method
.
stencil
dimensions
=
len
(
stencil
[
0
])
u_in
=
params
[
'
velocity_input
'
]
force
=
params
[
'
force
'
]
src_field
=
opt_params
[
'
symbolic_field
'
]
dst_field
=
opt_params
[
'
symbolic_temporary_field
'
]
src_field
=
symbolic_fields
[
'
symbolic_field
'
]
dst_field
=
symbolic_fields
[
'
symbolic_temporary_field
'
]
moment_matrix
=
lb_method
.
moment_matrix
rel
=
lb_method
.
relaxation_rates
...
...
@@ -364,7 +361,8 @@ def get_collision_assignments_hydro(density=1, optimization=None, sub_iterations
m
=
sp
.
symbols
(
"
m_:{}
"
.
format
(
len
(
stencil
)))
update_m
=
get_update_rules_velocity
(
src_field
,
u_in
,
lb_method
,
force
,
density
,
sub_iterations
=
sub_iterations
)
update_m
=
get_update_rules_velocity
(
src_field
,
velocity_input
,
lb_method
,
force
,
density
,
sub_iterations
=
sub_iterations
)
u_symp
=
sp
.
symbols
(
"
u_:{}
"
.
format
(
dimensions
))
for
i
in
range
(
0
,
len
(
stencil
)):
...
...
@@ -372,7 +370,7 @@ def get_collision_assignments_hydro(density=1, optimization=None, sub_iterations
update_g
=
list
()
var
=
np
.
dot
(
moment_matrix
.
inv
().
tolist
(),
m
)
if
params
[
'
kernel_type
'
]
==
'
collide_stream_push
'
:
if
kernel_type
==
'
collide_stream_push
'
:
push_accessor
=
StreamPushTwoFieldsAccessor
()
post_collision_accesses
=
push_accessor
.
write
(
dst_field
,
stencil
)
else
:
...
...
@@ -383,7 +381,7 @@ def get_collision_assignments_hydro(density=1, optimization=None, sub_iterations
update_g
.
append
(
Assignment
(
post_collision_accesses
[
i
],
var
[
i
]))
for
i
in
range
(
dimensions
):
update_g
.
append
(
Assignment
(
u_in
.
center_vector
[
i
],
u_symp
[
i
]))
update_g
.
append
(
Assignment
(
velocity_input
.
center_vector
[
i
],
u_symp
[
i
]))
hydro_lb_update_rule
=
AssignmentCollection
(
main_assignments
=
update_g
,
subexpressions
=
update_m
)
...
...
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