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
66642bc1
Commit
66642bc1
authored
7 years ago
by
Michael Kuron
Browse files
Options
Downloads
Patches
Plain Diff
Allow use of custom force model classes in generation
parent
812d1fab
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
creationfunctions.py
+10
-4
10 additions, 4 deletions
creationfunctions.py
with
10 additions
and
4 deletions
creationfunctions.py
+
10
−
4
View file @
66642bc1
...
@@ -40,7 +40,8 @@ General:
...
@@ -40,7 +40,8 @@ General:
compressible.
compressible.
- ``equilibriumAccuracyOrder=2``: order in velocity, at which the equilibrium moment/cumulant approximation is
- ``equilibriumAccuracyOrder=2``: order in velocity, at which the equilibrium moment/cumulant approximation is
truncated. Order 2 is sufficient to approximate Navier-Stokes
truncated. Order 2 is sufficient to approximate Navier-Stokes
- ``forceModel=None``: possible values: ``None``, ``
'
simple
'
``, ``
'
luo
'
``, ``
'
guo
'
`` or ``
'
buick
'
``. For details see
- ``forceModel=None``: possible values: ``None``, ``
'
simple
'
``, ``
'
luo
'
``, ``
'
guo
'
`` ``
'
buick
'
``, or an instance of a
class implementing the same methods as the classes in :mod:`lbmpy.forcemodels`. For details, see
:mod:`lbmpy.forcemodels`
:mod:`lbmpy.forcemodels`
- ``force=(0,0,0)``: either constant force or a symbolic expression depending on field value
- ``force=(0,0,0)``: either constant force or a symbolic expression depending on field value
- ``useContinuousMaxwellianEquilibrium=True``: way to compute equilibrium moments/cumulants, if False the standard
- ``useContinuousMaxwellianEquilibrium=True``: way to compute equilibrium moments/cumulants, if False the standard
...
@@ -325,17 +326,20 @@ def createLatticeBoltzmannAst(updateRule=None, optimizationParams={}, **kwargs):
...
@@ -325,17 +326,20 @@ def createLatticeBoltzmannAst(updateRule=None, optimizationParams={}, **kwargs):
def
createLatticeBoltzmannUpdateRule
(
lbMethod
=
None
,
optimizationParams
=
{},
**
kwargs
):
def
createLatticeBoltzmannUpdateRule
(
lbMethod
=
None
,
optimizationParams
=
{},
**
kwargs
):
params
,
optParams
=
updateWithDefaultParameters
(
kwargs
,
optimizationParams
)
params
,
optParams
=
updateWithDefaultParameters
(
kwargs
,
optimizationParams
)
forceModel
=
params
[
"
forceModel
"
]
del
params
[
"
forceModel
"
]
parameters
=
json
.
dumps
({
parameters
=
json
.
dumps
({
'
params
'
:
params
,
'
params
'
:
params
,
'
optParams
'
:
optParams
,
'
optParams
'
:
optParams
,
},
cls
=
SympyJSONEncoder
,
sort_keys
=
True
)
},
cls
=
SympyJSONEncoder
,
sort_keys
=
True
)
return
_createLatticeBoltzmannUpdateRuleCached
(
parameters
,
lbMethod
)
return
_createLatticeBoltzmannUpdateRuleCached
(
parameters
,
forceModel
,
lbMethod
)
@diskcache
@diskcache
def
_createLatticeBoltzmannUpdateRuleCached
(
stringParameters
,
lbMethod
=
None
):
def
_createLatticeBoltzmannUpdateRuleCached
(
stringParameters
,
forceModel
,
lbMethod
=
None
):
parsedParams
=
json
.
loads
(
stringParameters
,
cls
=
SympyJSONDecoder
)
parsedParams
=
json
.
loads
(
stringParameters
,
cls
=
SympyJSONDecoder
)
params
,
optParams
=
parsedParams
[
'
params
'
],
parsedParams
[
'
optParams
'
]
params
,
optParams
=
parsedParams
[
'
params
'
],
parsedParams
[
'
optParams
'
]
params
[
'
forceModel
'
]
=
forceModel
stencil
=
getStencil
(
params
[
'
stencil
'
])
stencil
=
getStencil
(
params
[
'
stencil
'
])
...
@@ -414,7 +418,9 @@ def createLatticeBoltzmannMethod(**params):
...
@@ -414,7 +418,9 @@ def createLatticeBoltzmannMethod(**params):
if
'
forceModel
'
in
params
:
if
'
forceModel
'
in
params
:
forceModelName
=
params
[
'
forceModel
'
]
forceModelName
=
params
[
'
forceModel
'
]
if
forceModelName
.
lower
()
==
'
none
'
:
if
type
(
forceModelName
)
is
not
str
:
forceModel
=
forceModelName
elif
forceModelName
.
lower
()
==
'
none
'
:
forceModel
=
None
forceModel
=
None
elif
forceModelName
.
lower
()
==
'
simple
'
:
elif
forceModelName
.
lower
()
==
'
simple
'
:
forceModel
=
forceModels
.
Simple
(
params
[
'
force
'
][:
dim
])
forceModel
=
forceModels
.
Simple
(
params
[
'
force
'
][:
dim
])
...
...
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