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
1ce9bcb7
Commit
1ce9bcb7
authored
9 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Add divergence theorem test
parent
461446a0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_grudge.py
+43
-3
43 additions, 3 deletions
test/test_grudge.py
with
43 additions
and
3 deletions
test/test_grudge.py
+
43
−
3
View file @
1ce9bcb7
...
...
@@ -41,7 +41,7 @@ from grudge import sym, bind, Discretization
@pytest.mark.parametrize
(
"
dim
"
,
[
2
,
3
])
def
test_inverse_metric
(
ctx_
getter
,
dim
):
def
test_inverse_metric
(
ctx_
factory
,
dim
):
cl_ctx
=
cl
.
create_some_context
()
queue
=
cl
.
CommandQueue
(
cl_ctx
)
...
...
@@ -85,7 +85,7 @@ def test_inverse_metric(ctx_getter, dim):
assert
err
<
1e-12
,
(
i
,
j
,
err
)
def
test_1d_mass_mat_trig
(
ctx_
getter
):
def
test_1d_mass_mat_trig
(
ctx_
factory
):
"""
Check the integral of some trig functions on an interval using the mass
matrix
"""
...
...
@@ -121,7 +121,7 @@ def test_1d_mass_mat_trig(ctx_getter):
@pytest.mark.parametrize
(
"
dim
"
,
[
1
,
2
,
3
])
def
test_tri_diff_mat
(
ctx_
getter
,
dim
,
order
=
4
):
def
test_tri_diff_mat
(
ctx_
factory
,
dim
,
order
=
4
):
"""
Check differentiation matrix along the coordinate axes on a disk
Uses sines as the function to differentiate.
...
...
@@ -161,6 +161,46 @@ def test_tri_diff_mat(ctx_getter, dim, order=4):
assert
eoc_rec
.
order_estimate
()
>=
order
def
test_2d_gauss_theorem
(
ctx_factory
):
"""
Verify Gauss
'
s theorem explicitly on a mesh
"""
from
meshpy.geometry
import
make_circle
,
GeometryBuilder
from
meshpy.triangle
import
MeshInfo
,
build
geob
=
GeometryBuilder
()
geob
.
add_geometry
(
*
make_circle
(
1
))
mesh_info
=
MeshInfo
()
geob
.
set
(
mesh_info
)
mesh_info
=
build
(
mesh_info
)
from
meshmode.mesh.io
import
from_meshpy
mesh
=
from_meshpy
(
mesh_info
,
order
=
1
)
cl_ctx
=
cl
.
create_some_context
()
queue
=
cl
.
CommandQueue
(
cl_ctx
)
discr
=
Discretization
(
cl_ctx
,
mesh
,
order
=
2
)
def
f
(
x
):
return
sym
.
join_fields
(
sym
.
sin
(
3
*
x
[
0
])
+
sym
.
cos
(
3
*
x
[
1
]),
sym
.
sin
(
2
*
x
[
0
])
+
sym
.
cos
(
x
[
1
]))
gauss_err
=
bind
(
discr
,
sym
.
integral
((
sym
.
nabla
(
2
)
*
f
(
sym
.
nodes
(
2
))
).
sum
())
-
sym
.
integral
(
sym
.
interp
(
"
vol
"
,
sym
.
BTAG_ALL
)(
f
(
sym
.
nodes
(
2
)))
.
dot
(
sym
.
normal
(
sym
.
BTAG_ALL
,
2
)),
dd
=
sym
.
BTAG_ALL
)
)(
queue
)
assert
abs
(
gauss_err
.
get
())
<
5e-15
# You can test individual routines by typing
# $ python test_layer_pot.py 'test_routine()'
...
...
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