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
27b86f84
Commit
27b86f84
authored
4 years ago
by
Markus Holzer
Committed by
Michael Kuron
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Move special fd stencils to lbmpy
parent
0023726c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
lbmpy/phasefield/fd_stencils.py
+32
-0
32 additions, 0 deletions
lbmpy/phasefield/fd_stencils.py
lbmpy_tests/phasefield/test_entropic_model.ipynb
+31
-27
31 additions, 27 deletions
lbmpy_tests/phasefield/test_entropic_model.ipynb
with
65 additions
and
28 deletions
.gitignore
+
2
−
1
View file @
27b86f84
...
...
@@ -11,5 +11,6 @@ _build
/.idea
_local_tmp
**/.vscode
/lbmpy_tests/db
doc/bibtex.json
/html_doc
\ No newline at end of file
/html_doc
This diff is collapsed.
Click to expand it.
lbmpy/phasefield/fd_stencils.py
0 → 100644
+
32
−
0
View file @
27b86f84
import
sympy
as
sp
from
pystencils.fd.spatial
import
fd_stencils_standard
def
fd_stencils_isotropic_high_density_code
(
indices
,
dx
,
fa
):
dim
=
fa
.
field
.
spatial_dimensions
if
dim
==
1
:
return
fd_stencils_standard
(
indices
,
dx
,
fa
)
elif
dim
==
2
:
order
=
len
(
indices
)
if
order
==
1
:
idx
=
indices
[
0
]
assert
0
<=
idx
<
2
other_idx
=
1
if
indices
[
0
]
==
0
else
0
weights
=
{
-
1
:
sp
.
Rational
(
1
,
12
)
/
dx
,
0
:
sp
.
Rational
(
1
,
3
)
/
dx
,
1
:
sp
.
Rational
(
1
,
12
)
/
dx
}
upper_terms
=
sum
(
fa
.
neighbor
(
idx
,
+
1
).
neighbor
(
other_idx
,
off
)
*
w
for
off
,
w
in
weights
.
items
())
lower_terms
=
sum
(
fa
.
neighbor
(
idx
,
-
1
).
neighbor
(
other_idx
,
off
)
*
w
for
off
,
w
in
weights
.
items
())
return
upper_terms
-
lower_terms
elif
order
==
2
:
if
indices
[
0
]
==
indices
[
1
]:
idx
=
indices
[
0
]
diagonals
=
sp
.
Rational
(
1
,
8
)
*
sum
(
fa
.
neighbor
(
0
,
i
).
neighbor
(
1
,
j
)
for
i
in
(
-
1
,
1
)
for
j
in
(
-
1
,
1
))
div_direction
=
sp
.
Rational
(
1
,
2
)
*
sum
(
fa
.
neighbor
(
idx
,
i
)
for
i
in
(
-
1
,
1
))
center
=
-
sp
.
Rational
(
3
,
2
)
*
fa
return
(
diagonals
+
div_direction
+
center
)
/
(
dx
**
2
)
else
:
return
fd_stencils_standard
(
indices
,
dx
,
fa
)
raise
NotImplementedError
(
"
Supports only derivatives up to order 2 for 1D and 2D setups
"
)
This diff is collapsed.
Click to expand it.
lbmpy_tests/phasefield/test_entropic_model.ipynb
+
31
−
27
View file @
27b86f84
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
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