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
12cfcaf8
Commit
12cfcaf8
authored
3 years ago
by
Markus Holzer
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes
parent
482f60c6
No related branches found
No related tags found
1 merge request
!91
Improved Moment-Based Method
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lbmpy/moment_transforms/abstractmomenttransform.py
+1
-1
1 addition, 1 deletion
lbmpy/moment_transforms/abstractmomenttransform.py
lbmpy/moment_transforms/momenttransforms.py
+16
-12
16 additions, 12 deletions
lbmpy/moment_transforms/momenttransforms.py
with
17 additions
and
13 deletions
lbmpy/moment_transforms/abstractmomenttransform.py
+
1
−
1
View file @
12cfcaf8
...
...
@@ -42,7 +42,7 @@ class AbstractMomentTransform:
Transformations from the population space to any space of observable quantities may *absorb* the equations
defining the macroscopic quantities entering the equilibrium (typically the density :math:`\rho` and the
velocity :math:`\
vec
{u}`). This means that the :func:`forward_transform` will possibly rewrite the
velocity :math:`\
mathbf
{u}`). This means that the :func:`forward_transform` will possibly rewrite the
assignments given in the constructor argument ``conserved_quantity_equations`` to reduce
the total operation count. For example, in the transformation step from populations to
raw moments (see `PdfsToMomentsByChimeraTransform`), :math:`\rho` can be aliased as the zeroth-order moment
...
...
This diff is collapsed.
Click to expand it.
lbmpy/moment_transforms/momenttransforms.py
+
16
−
12
View file @
12cfcaf8
...
...
@@ -62,7 +62,7 @@ class PdfsToMomentsByMatrixTransform(AbstractMomentTransform):
moments, expressed in terms of the pre-collision populations by matrix-multiplication.
The moment transformation matrix :math:`M` provided by :func:`lbmpy.moments.moment_matrix` is
used to compute the pre-collision moments as :math:`\
vec
{m}_{pre} = M \cdot \
vec
{f}_{pre}`,
used to compute the pre-collision moments as :math:`\
mathbf
{m}_{pre} = M \cdot \
mathbf
{f}_{pre}`,
which is returned element-wise.
Args:
...
...
@@ -89,19 +89,20 @@ class PdfsToMomentsByMatrixTransform(AbstractMomentTransform):
The moment transformation matrix :math:`M` provided by :func:`lbmpy.moments.moment_matrix` is
inverted and used to compute the pre-collision moments as
:math:`\
vec{f}_
{post} = M^{-1} \cdot \
vec{m}_
{post}`, which is returned element-wise.
:math:`\
mathbf{f}_{\mathrm
{post}
}
= M^{-1} \cdot \
mathbf{m}_{\mathrm
{post}
}
`, which is returned element-wise.
**Simplifications**
If simplification is enabled, the equations for populations :math:`f_i` and :math:`f_{\bar{i}}`
of opposite stencil directions :math:`\vec{c}_i` and :math:`\vec{c}_{\bar{i}} = - \vec{c}_i`
are split into their symmetric and antisymmetric parts :math:`f_i^{sym}, f_i^{anti}`, such that
of opposite stencil directions :math:`\mathbf{c}_i` and :math:`\mathbf{c}_{\bar{i}} = - \mathbf{c}_i`
are split into their symmetric and antisymmetric parts :math:`f_i^{\mathrm{sym}}, f_i^{\mathrm{anti}}`, such
that
.. math::
f_i = f_i^{sym} + f_i^{anti}
f_i = f_i^{
\mathrm{
sym}
}
+ f_i^{
\mathrm{
anti}
}
f_{\bar{i}} = f_i^{sym} - f_i^{anti}
f_{\bar{i}} = f_i^{
\mathrm{
sym}
}
- f_i^{
\mathrm{
anti}
}
Args:
...
...
@@ -262,6 +263,7 @@ class PdfsToMomentsByChimeraTransform(AbstractMomentTransform):
pdf_symbols: List of symbols that represent the pre-collision populations
simplification: Simplification specification. See :class:`AbstractMomentTransform`
subexpression_base: The base name used for any subexpressions of the transformation.
return_raw_moments: If True raw moment equations are returned as main assignments
"""
simplification
=
self
.
_get_simp_strategy
(
simplification
,
'
forward
'
)
...
...
@@ -327,28 +329,30 @@ class PdfsToMomentsByChimeraTransform(AbstractMomentTransform):
r
"""
Returns an assignment collection containing equations for post-collision populations,
expressed in terms of the post-collision polynomial moments by matrix-multiplication.
The post-collision raw moments :math:`\
vec{m}_
{post}` are first obtained from the polynomials.
The post-collision raw moments :math:`\
mathbf{m}_{\mathrm
{post}
}
` are first obtained from the polynomials.
Then, the raw moment transformation matrix :math:`M_r` provided by :func:`lbmpy.moments.moment_matrix`
is inverted and used to compute the pre-collision moments as
:math:`\
vec{f}_
{post} = M_r^{-1} \cdot \
vec{m}_
{post}`.
:math:`\
mathbf{f}_{\mathrm
{post}
}
= M_r^{-1} \cdot \
mathbf{m}_{\mathrm
{post}
}
`.
**Simplifications**
If simplification is enabled, the equations for populations :math:`f_i` and :math:`f_{\bar{i}}`
of opposite stencil directions :math:`\vec{c}_i` and :math:`\vec{c}_{\bar{i}} = - \vec{c}_i`
are split into their symmetric and antisymmetric parts :math:`f_i^{sym}, f_i^{anti}`, such that
of opposite stencil directions :math:`\mathbf{c}_i` and :math:`\mathbf{c}_{\bar{i}} = - \mathbf{c}_i`
are split into their symmetric and antisymmetric parts :math:`f_i^{\mathrm{sym}}, f_i^{\mathrm{anti}}`, such
that
.. math::
f_i = f_i^{sym} + f_i^{anti}
f_i = f_i^{
\mathrm{
sym}
}
+ f_i^{
\mathrm{
anti}
}
f_{\bar{i}} = f_i^{sym} - f_i^{anti}
f_{\bar{i}} = f_i^{
\mathrm{
sym}
}
- f_i^{
\mathrm{
anti}
}
Args:
pdf_symbols: List of symbols that represent the post-collision populations
simplification: Simplification specification. See :class:`AbstractMomentTransform`
subexpression_base: The base name used for any subexpressions of the transformation.
start_from_raw_moments: If set to True the equations are not converted to monomials
"""
simplification
=
self
.
_get_simp_strategy
(
simplification
,
'
backward
'
)
...
...
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