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
a2967d8f
Commit
a2967d8f
authored
3 years ago
by
Thomas Gibson
Browse files
Options
Downloads
Patches
Plain Diff
Implement numerical integration in grudge.op
parent
315d4b96
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
grudge/op.py
+21
-1
21 additions, 1 deletion
grudge/op.py
with
21 additions
and
1 deletion
grudge/op.py
+
21
−
1
View file @
a2967d8f
...
@@ -508,7 +508,7 @@ def _apply_mass_operator(dcoll, dd_out, dd_in, vec):
...
@@ -508,7 +508,7 @@ def _apply_mass_operator(dcoll, dd_out, dd_in, vec):
def
mass
(
dcoll
,
*
args
):
def
mass
(
dcoll
,
*
args
):
if
len
(
args
)
==
1
:
if
len
(
args
)
==
1
:
vec
,
=
args
vec
,
=
args
dd
=
dof_desc
.
DOFDesc
(
"
vol
"
,
dof_desc
.
Q
TAG_
NON
E
)
dd
=
dof_desc
.
DOFDesc
(
"
vol
"
,
dof_desc
.
DISCR_
TAG_
BAS
E
)
elif
len
(
args
)
==
2
:
elif
len
(
args
)
==
2
:
dd
,
vec
=
args
dd
,
vec
=
args
else
:
else
:
...
@@ -863,6 +863,26 @@ def nodal_max(dcoll, dd, vec):
...
@@ -863,6 +863,26 @@ def nodal_max(dcoll, dd, vec):
return
np
.
max
([
actx
.
np
.
max
(
vec_i
)
for
vec_i
in
vec
])
return
np
.
max
([
actx
.
np
.
max
(
vec_i
)
for
vec_i
in
vec
])
def
integral
(
dcoll
,
vec
,
dd
=
None
):
if
dd
is
None
:
dd
=
dof_desc
.
DD_VOLUME
dd
=
dof_desc
.
as_dofdesc
(
dd
)
actx
=
vec
.
array_context
discr
=
dcoll
.
discr_from_dd
(
dd
)
ones
=
discr
.
zeros
(
actx
)
+
1
# TODO: Use actx.np.dot once it's added to the array context
flattened_mass_weights
=
actx
.
to_numpy
(
flatten
(
_apply_mass_operator
(
dcoll
,
dd
,
dd
,
ones
))
)
flattened_vec
=
actx
.
to_numpy
(
flatten
(
vec
))
return
np
.
dot
(
flattened_vec
,
flattened_mass_weights
)
# }}}
# }}}
...
...
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