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
Jonas Plewinski
pystencils
Commits
e8d3ca73
Commit
e8d3ca73
authored
6 years ago
by
Martin Bauer
Browse files
Options
Downloads
Patches
Plain Diff
Bugfixes for sympy 1.3
parent
6ef3d7d7
Branches
new-pe-world
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
data_types.py
+2
-0
2 additions, 0 deletions
data_types.py
fd/finitedifferences.py
+3
-3
3 additions, 3 deletions
fd/finitedifferences.py
kernel_decorator.py
+1
-1
1 addition, 1 deletion
kernel_decorator.py
with
6 additions
and
4 deletions
data_types.py
+
2
−
0
View file @
e8d3ca73
...
@@ -328,6 +328,8 @@ def get_type_of_expression(expr):
...
@@ -328,6 +328,8 @@ def get_type_of_expression(expr):
class
Type
(
sp
.
Basic
):
class
Type
(
sp
.
Basic
):
is_Atom
=
True
def
__new__
(
cls
,
*
args
,
**
kwargs
):
def
__new__
(
cls
,
*
args
,
**
kwargs
):
return
sp
.
Basic
.
__new__
(
cls
)
return
sp
.
Basic
.
__new__
(
cls
)
...
...
This diff is collapsed.
Click to expand it.
fd/finitedifferences.py
+
3
−
3
View file @
e8d3ca73
...
@@ -21,7 +21,7 @@ def diffusion(scalar, diffusion_coeff, idx=None):
...
@@ -21,7 +21,7 @@ def diffusion(scalar, diffusion_coeff, idx=None):
>>>
diffusion_term
=
diffusion
(
scalar
=
f
,
diffusion_coeff
=
sp
.
Symbol
(
"
d
"
))
>>>
diffusion_term
=
diffusion
(
scalar
=
f
,
diffusion_coeff
=
sp
.
Symbol
(
"
d
"
))
>>>
discretization
=
Discretization2ndOrder
()
>>>
discretization
=
Discretization2ndOrder
()
>>>
discretization
(
diffusion_term
)
>>>
discretization
(
diffusion_term
)
(
-
4
*
f_
C
*
d
+
f_
E
*
d
+
f_
N
*
d
+
f_
S
*
d
+
f_
W
*
d
)
/
dx
**
2
(
f_
W
*
d
+
f_
S
*
d
-
4
*
f_
C
*
d
+
f_
N
*
d
+
f_
E
*
d
)
/
dx
**
2
"""
"""
if
isinstance
(
scalar
,
Field
):
if
isinstance
(
scalar
,
Field
):
first_arg
=
scalar
.
center
first_arg
=
scalar
.
center
...
@@ -302,7 +302,7 @@ def discretize_center(term, symbols_to_field_dict, dx, dim=3):
...
@@ -302,7 +302,7 @@ def discretize_center(term, symbols_to_field_dict, dx, dim=3):
x
*
x
^
Delta
^
0
x
*
x
^
Delta
^
0
>>>
f
=
Field
.
create_generic
(
'
f
'
,
spatial_dimensions
=
3
)
>>>
f
=
Field
.
create_generic
(
'
f
'
,
spatial_dimensions
=
3
)
>>>
discretize_center
(
term
,
{
x
:
f
},
dx
=
1
,
dim
=
3
)
>>>
discretize_center
(
term
,
{
x
:
f
},
dx
=
1
,
dim
=
3
)
f_C
*
(
f_
E
/
2
-
f_
W
/
2
)
f_C
*
(
-
f_
W
/
2
+
f_
E
/
2
)
"""
"""
substitutions
=
{}
substitutions
=
{}
for
symbols
,
field
in
symbols_to_field_dict
.
items
():
for
symbols
,
field
in
symbols_to_field_dict
.
items
():
...
@@ -385,7 +385,7 @@ def discretize_divergence(vector_term, symbols_to_field_dict, dx):
...
@@ -385,7 +385,7 @@ def discretize_divergence(vector_term, symbols_to_field_dict, dx):
>>>
grad_x
=
grad
(
x
,
dim
=
3
)
>>>
grad_x
=
grad
(
x
,
dim
=
3
)
>>>
f
=
Field
.
create_generic
(
'
f
'
,
spatial_dimensions
=
3
)
>>>
f
=
Field
.
create_generic
(
'
f
'
,
spatial_dimensions
=
3
)
>>>
sp
.
simplify
(
discretize_divergence
(
grad_x
,
{
x
:
f
},
dx
))
>>>
sp
.
simplify
(
discretize_divergence
(
grad_x
,
{
x
:
f
},
dx
))
(
f_
B
-
6
*
f_
C
+
f_
E
+
f_
N
+
f_
S
+
f_
T
+
f_
W
)
/
dx
**
2
(
f_
W
+
f_
S
+
f_
B
-
6
*
f_
C
+
f_
T
+
f_
N
+
f_
E
)
/
dx
**
2
"""
"""
dim
=
len
(
vector_term
)
dim
=
len
(
vector_term
)
result
=
0
result
=
0
...
...
This diff is collapsed.
Click to expand it.
kernel_decorator.py
+
1
−
1
View file @
e8d3ca73
...
@@ -26,7 +26,7 @@ def kernel(func, **kwargs):
...
@@ -26,7 +26,7 @@ def kernel(func, **kwargs):
...
s
.
neighbors
@=
f
[
0
,
1
]
+
f
[
1
,
0
]
...
s
.
neighbors
@=
f
[
0
,
1
]
+
f
[
1
,
0
]
...
g
[
0
,
0
]
@=
s
.
neighbors
+
f
[
0
,
0
]
if
f
[
0
,
0
]
>
0
else
0
...
g
[
0
,
0
]
@=
s
.
neighbors
+
f
[
0
,
0
]
if
f
[
0
,
0
]
>
0
else
0
>>>
my_kernel
>>>
my_kernel
[
Assignment
(
neighbors
,
f_
E
+
f_
N
),
Assignment
(
g_C
,
Piecewise
((
f_C
+
neighbors
,
f_C
>
0
),
(
0
,
True
)))]
[
Assignment
(
neighbors
,
f_
N
+
f_
E
),
Assignment
(
g_C
,
Piecewise
((
f_C
+
neighbors
,
f_C
>
0
),
(
0
,
True
)))]
"""
"""
source
=
inspect
.
getsource
(
func
)
source
=
inspect
.
getsource
(
func
)
source
=
textwrap
.
dedent
(
source
)
source
=
textwrap
.
dedent
(
source
)
...
...
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