Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
grudge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
grudge
Commits
708dfdf0
Commit
708dfdf0
authored
4 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Eager wave examples: Use sane broadcasting
parent
c46b59c2
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!76
Overintegration for eager examples
,
!71
Array context
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/wave/wave-eager-mpi.py
+6
-6
6 additions, 6 deletions
examples/wave/wave-eager-mpi.py
examples/wave/wave-eager.py
+6
-6
6 additions, 6 deletions
examples/wave/wave-eager.py
with
12 additions
and
12 deletions
examples/wave/wave-eager-mpi.py
+
6
−
6
View file @
708dfdf0
...
@@ -43,26 +43,26 @@ from mpi4py import MPI
...
@@ -43,26 +43,26 @@ from mpi4py import MPI
# {{{ wave equation bits
# {{{ wave equation bits
def
scalar
(
arg
):
return
make_obj_array
([
arg
])
def
wave_flux
(
discr
,
c
,
w_tpair
):
def
wave_flux
(
discr
,
c
,
w_tpair
):
u
=
w_tpair
[
0
]
u
=
w_tpair
[
0
]
v
=
w_tpair
[
1
:]
v
=
w_tpair
[
1
:]
normal
=
thaw
(
u
.
int
.
array_context
,
discr
.
normal
(
w_tpair
.
dd
))
normal
=
thaw
(
u
.
int
.
array_context
,
discr
.
normal
(
w_tpair
.
dd
))
def
normal_times
(
scalar
):
# workaround for object array behavior
return
make_obj_array
([
ni
*
scalar
for
ni
in
normal
])
flux_weak
=
flat_obj_array
(
flux_weak
=
flat_obj_array
(
np
.
dot
(
v
.
avg
,
normal
),
np
.
dot
(
v
.
avg
,
normal
),
normal
_times
(
u
.
avg
),
normal
*
scalar
(
u
.
avg
),
)
)
# upwind
# upwind
v_jump
=
np
.
dot
(
normal
,
v
.
int
-
v
.
ext
)
v_jump
=
np
.
dot
(
normal
,
v
.
int
-
v
.
ext
)
flux_weak
-=
flat_obj_array
(
flux_weak
-=
flat_obj_array
(
0.5
*
(
u
.
int
-
u
.
ext
),
0.5
*
(
u
.
int
-
u
.
ext
),
0.5
*
normal
_times
(
v_jump
),
0.5
*
normal
*
scalar
(
v_jump
),
)
)
return
discr
.
project
(
w_tpair
.
dd
,
"
all_faces
"
,
c
*
flux_weak
)
return
discr
.
project
(
w_tpair
.
dd
,
"
all_faces
"
,
c
*
flux_weak
)
...
...
This diff is collapsed.
Click to expand it.
examples/wave/wave-eager.py
+
6
−
6
View file @
708dfdf0
...
@@ -41,26 +41,26 @@ from grudge.symbolic.primitives import TracePair
...
@@ -41,26 +41,26 @@ from grudge.symbolic.primitives import TracePair
# {{{ wave equation bits
# {{{ wave equation bits
def
scalar
(
arg
):
return
make_obj_array
([
arg
])
def
wave_flux
(
discr
,
c
,
w_tpair
):
def
wave_flux
(
discr
,
c
,
w_tpair
):
u
=
w_tpair
[
0
]
u
=
w_tpair
[
0
]
v
=
w_tpair
[
1
:]
v
=
w_tpair
[
1
:]
normal
=
thaw
(
u
.
int
.
array_context
,
discr
.
normal
(
w_tpair
.
dd
))
normal
=
thaw
(
u
.
int
.
array_context
,
discr
.
normal
(
w_tpair
.
dd
))
def
normal_times
(
scalar
):
# workaround for object array behavior
return
make_obj_array
([
ni
*
scalar
for
ni
in
normal
])
flux_weak
=
flat_obj_array
(
flux_weak
=
flat_obj_array
(
np
.
dot
(
v
.
avg
,
normal
),
np
.
dot
(
v
.
avg
,
normal
),
normal
_times
(
u
.
avg
),
normal
*
scalar
(
u
.
avg
),
)
)
# upwind
# upwind
v_jump
=
np
.
dot
(
normal
,
v
.
int
-
v
.
ext
)
v_jump
=
np
.
dot
(
normal
,
v
.
int
-
v
.
ext
)
flux_weak
-=
flat_obj_array
(
flux_weak
-=
flat_obj_array
(
0.5
*
(
u
.
int
-
u
.
ext
),
0.5
*
(
u
.
int
-
u
.
ext
),
0.5
*
normal
_times
(
v_jump
),
0.5
*
normal
*
scalar
(
v_jump
),
)
)
return
discr
.
project
(
w_tpair
.
dd
,
"
all_faces
"
,
c
*
flux_weak
)
return
discr
.
project
(
w_tpair
.
dd
,
"
all_faces
"
,
c
*
flux_weak
)
...
...
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