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
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
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
Alexandru Fikl
grudge
Commits
a6da4eab
Commit
a6da4eab
authored
7 years ago
by
Bogdan Enache
Browse files
Options
Downloads
Patches
Plain Diff
There was an attempt at the right way of doing upwind fluxes
parent
99326552
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/wave/var-propagation-speed.py
+1
-1
1 addition, 1 deletion
examples/wave/var-propagation-speed.py
grudge/models/wave.py
+37
-18
37 additions, 18 deletions
grudge/models/wave.py
with
38 additions
and
19 deletions
examples/wave/var-propagation-speed.py
+
1
−
1
View file @
a6da4eab
...
...
@@ -67,7 +67,7 @@ def main(write_output=True, order=4):
dirichlet_tag
=
BTAG_NONE
,
neumann_tag
=
BTAG_NONE
,
radiation_tag
=
BTAG_ALL
,
flux_type
=
"
central
"
)
flux_type
=
"
upwind
"
)
queue
=
cl
.
CommandQueue
(
discr
.
cl_context
)
from
pytools.obj_array
import
join_fields
...
...
This diff is collapsed.
Click to expand it.
grudge/models/wave.py
+
37
−
18
View file @
a6da4eab
...
...
@@ -363,22 +363,37 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator):
self
.
flux_type
=
flux_type
def
flux
(
self
,
w
):
u
=
w
[
0
]
v
=
w
[
1
:]
c
=
w
[
0
]
u
=
w
[
1
]
v
=
w
[
2
:]
normal
=
sym
.
normal
(
w
.
dd
,
self
.
ambient_dim
)
surf_c
=
sym
.
interp
(
"
vol
"
,
u
.
dd
)(
self
.
c
)
flux_weak
=
join_fields
(
np
.
dot
(
v
.
avg
,
normal
),
u
.
avg
*
normal
)
np
.
dot
(
v
.
int
*
c
.
int
+
v
.
ext
*
c
.
ext
,
normal
),
(
u
.
int
*
c
.
int
+
u
.
ext
*
c
.
ext
)
*
normal
)
*
-
0.5
flux
=
sym
.
interp
(
"
vol
"
,
u
.
dd
)(
self
.
sign
)
*
join_fields
(
c
.
ext
*
np
.
dot
(
v
.
ext
,
normal
)
-
c
.
int
*
np
.
dot
(
v
.
int
,
normal
),
normal
*
(
c
.
ext
*
u
.
ext
-
c
.
int
*
u
.
int
))
*
-
0.5
flux_strong
=
join_fields
(
np
.
dot
(
v
.
int
,
normal
),
u
.
int
*
normal
)
*
-
c
.
int
if
self
.
flux_type
==
"
central
"
:
return
-
surf_c
*
flux_weak
return
flux_strong
-
flux
elif
self
.
flux_type
==
"
upwind
"
:
return
-
self
.
c
*
(
flux_weak
+
self
.
sign
*
join_fields
(
0.5
*
(
u
.
int
-
u
.
ext
),
0.5
*
(
normal
*
np
.
dot
(
normal
,
v
.
int
-
v
.
ext
))))
flux
+=
join_fields
(
c
.
ext
*
u
.
ext
-
c
.
int
*
u
.
int
,
c
.
ext
*
normal
*
np
.
dot
(
normal
,
v
.
ext
)
-
c
.
int
*
normal
*
np
.
dot
(
normal
,
v
.
int
)
)
return
flux_strong
-
flux
return
(
flux_weak
+
join_fields
(
c
.
ext
*
u
.
ext
-
c
.
int
*
u
.
int
,
c
.
ext
*
normal
*
np
.
dot
(
normal
,
v
.
ext
)
-
c
.
int
*
normal
*
np
.
dot
(
normal
,
v
.
int
)
))
else
:
raise
ValueError
(
"
invalid flux type
'
%s
'"
%
self
.
flux_type
)
...
...
@@ -388,10 +403,12 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator):
w
=
sym
.
make_sym_array
(
"
w
"
,
d
+
1
)
u
=
w
[
0
]
v
=
w
[
1
:]
flux_w
=
join_fields
(
self
.
c
,
w
)
# boundary conditions -------------------------------------------------
# dirichlet BCs -------------------------------------------------------
dir_c
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
dirichlet_tag
)(
self
.
c
))
dir_u
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
dirichlet_tag
)(
u
))
dir_v
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
dirichlet_tag
)(
v
))
if
self
.
dirichlet_bc_f
:
...
...
@@ -401,24 +418,26 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator):
"
are still having issues.
"
)
dir_g
=
sym
.
Field
(
"
dir_bc_u
"
)
dir_bc
=
join_fields
(
2
*
dir_g
-
dir_u
,
dir_v
)
dir_bc
=
join_fields
(
dir_c
,
2
*
dir_g
-
dir_u
,
dir_v
)
else
:
dir_bc
=
join_fields
(
-
dir_u
,
dir_v
)
dir_bc
=
join_fields
(
dir_c
,
-
dir_u
,
dir_v
)
dir_bc
=
sym
.
cse
(
dir_bc
,
"
dir_bc
"
)
# neumann BCs ---------------------------------------------------------
neu_c
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
neumann_tag
)(
self
.
c
))
neu_u
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
neumann_tag
)(
u
))
neu_v
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
neumann_tag
)(
v
))
neu_bc
=
sym
.
cse
(
join_fields
(
neu_u
,
-
neu_v
),
"
neu_bc
"
)
neu_bc
=
sym
.
cse
(
join_fields
(
neu_
c
,
neu_
u
,
-
neu_v
),
"
neu_bc
"
)
# radiation BCs -------------------------------------------------------
rad_normal
=
sym
.
normal
(
self
.
radiation_tag
,
d
)
rad_c
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
radiation_tag
)(
self
.
c
))
rad_u
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
radiation_tag
)(
u
))
rad_v
=
sym
.
cse
(
sym
.
interp
(
"
vol
"
,
self
.
radiation_tag
)(
v
))
rad_bc
=
sym
.
cse
(
join_fields
(
rad_bc
=
sym
.
cse
(
join_fields
(
rad_c
,
0.5
*
(
rad_u
-
sym
.
interp
(
"
vol
"
,
self
.
radiation_tag
)(
self
.
sign
)
*
np
.
dot
(
rad_normal
,
rad_v
)),
0.5
*
rad_normal
*
(
np
.
dot
(
rad_normal
,
rad_v
)
...
...
@@ -436,10 +455,10 @@ class VariableCoefficientWeakWaveOperator(HyperbolicOperator):
)
-
sym
.
FaceMassOperator
()(
flux
(
sym
.
int_tpair
(
w
))
+
flux
(
sym
.
bv_tpair
(
self
.
dirichlet_tag
,
w
,
dir_bc
))
+
flux
(
sym
.
bv_tpair
(
self
.
neumann_tag
,
w
,
neu_bc
))
+
flux
(
sym
.
bv_tpair
(
self
.
radiation_tag
,
w
,
rad_bc
))
-
sym
.
FaceMassOperator
()(
flux
(
sym
.
int_tpair
(
flux_
w
))
+
flux
(
sym
.
bv_tpair
(
self
.
dirichlet_tag
,
flux_
w
,
dir_bc
))
+
flux
(
sym
.
bv_tpair
(
self
.
neumann_tag
,
flux_
w
,
neu_bc
))
+
flux
(
sym
.
bv_tpair
(
self
.
radiation_tag
,
flux_
w
,
rad_bc
))
))
...
...
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