Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
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
Tom Harke
pystencils
Commits
d01a0422
Commit
d01a0422
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Moved phase field plotting functions from lbmpy to pystencils
parent
61d1bae6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pystencils/plot2d.py
+23
-0
23 additions, 0 deletions
pystencils/plot2d.py
with
23 additions
and
0 deletions
pystencils/plot2d.py
+
23
−
0
View file @
d01a0422
...
@@ -4,6 +4,8 @@ simulation coordinate system (y-axis goes up), instead of the "image coordinate
...
@@ -4,6 +4,8 @@ simulation coordinate system (y-axis goes up), instead of the "image coordinate
matplotlib normally uses.
matplotlib normally uses.
"""
"""
from
matplotlib.pyplot
import
*
from
matplotlib.pyplot
import
*
from
itertools
import
cycle
from
matplotlib.text
import
Text
def
vector_field
(
array
,
step
=
2
,
**
kwargs
):
def
vector_field
(
array
,
step
=
2
,
**
kwargs
):
...
@@ -135,6 +137,27 @@ def multiple_scalar_fields(array, **kwargs):
...
@@ -135,6 +137,27 @@ def multiple_scalar_fields(array, **kwargs):
colorbar
()
colorbar
()
def
phase_plot
(
phase_field
:
np
.
ndarray
,
linewidth
=
1.0
,
clip
=
True
)
->
None
:
"""
Plots a phase field array using the phase variables as alpha channel.
Args:
phase_field: array with len(shape) == 3, first two dimensions are spatial, the last one indexes the phase
components.
linewidth: line width of the 0.5 contour lines that are drawn over the alpha blended phase images
clip: see scalar_field_alpha_value function
"""
color_cycle
=
cycle
([
'
#fe0002
'
,
'
#00fe00
'
,
'
#0000ff
'
,
'
#ffa800
'
,
'
#f600ff
'
])
assert
len
(
phase_field
.
shape
)
==
3
with
warnings
.
catch_warnings
():
warnings
.
simplefilter
(
"
ignore
"
)
for
i
in
range
(
phase_field
.
shape
[
-
1
]):
scalar_field_alpha_value
(
phase_field
[...,
i
],
next
(
color_cycle
),
clip
=
clip
,
interpolation
=
'
bilinear
'
)
if
linewidth
:
for
i
in
range
(
phase_field
.
shape
[
-
1
]):
scalar_field_contour
(
phase_field
[...,
i
],
levels
=
[
0.5
],
colors
=
'
k
'
,
linewidths
=
[
linewidth
])
def
sympy_function
(
expr
,
x_values
=
None
,
**
kwargs
):
def
sympy_function
(
expr
,
x_values
=
None
,
**
kwargs
):
"""
Plots the graph of a sympy term that depends on one symbol only.
"""
Plots the graph of a sympy term that depends on one symbol only.
...
...
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