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
267fa878
Commit
267fa878
authored
3 years ago
by
Thomas Gibson
Browse files
Options
Downloads
Patches
Plain Diff
Test non geometric factors
parent
b5f5f1f6
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
test/test_dt_utils.py
+42
-0
42 additions, 0 deletions
test/test_dt_utils.py
with
42 additions
and
0 deletions
test/test_dt_utils.py
+
42
−
0
View file @
267fa878
...
...
@@ -76,6 +76,48 @@ def test_geometric_factors_regular_refinement(actx_factory, name):
assert
np
.
all
(
np
.
isclose
(
ratios
,
2
))
@pytest.mark.parametrize
(
"
name
"
,
[
"
interval
"
,
"
box2d
"
,
"
box3d
"
])
def
test_non_geometric_factors
(
actx_factory
,
name
):
from
grudge.dt_utils
import
dt_non_geometric_factor
,
dt_geometric_factors
actx
=
actx_factory
()
# {{{ cases
if
name
==
"
interval
"
:
from
mesh_data
import
BoxMeshBuilder
builder
=
BoxMeshBuilder
(
ambient_dim
=
1
)
elif
name
==
"
box2d
"
:
from
mesh_data
import
BoxMeshBuilder
builder
=
BoxMeshBuilder
(
ambient_dim
=
2
)
elif
name
==
"
box3d
"
:
from
mesh_data
import
BoxMeshBuilder
builder
=
BoxMeshBuilder
(
ambient_dim
=
3
)
else
:
raise
ValueError
(
"
unknown geometry name: %s
"
%
name
)
# }}}
factors
=
[]
geom_factors
=
[]
degrees
=
list
(
range
(
1
,
8
))
for
degree
in
degrees
:
mesh
=
builder
.
get_mesh
(
1
,
degree
)
dcoll
=
DiscretizationCollection
(
actx
,
mesh
,
order
=
degree
)
factors
.
append
(
dt_non_geometric_factor
(
dcoll
))
geom_factors
.
append
(
op
.
nodal_min
(
dcoll
,
"
vol
"
,
dt_geometric_factors
(
dcoll
))
)
# Crude estimate, factors should behave like 1/N**2
factors
=
np
.
asarray
(
factors
)
geom_factors
=
np
.
asarray
(
geom_factors
)
lower_bounds
=
1
/
(
np
.
asarray
(
degrees
)
**
2
)
upper_bounds
=
geom_factors
*
lower_bounds
assert
lower_bounds
.
all
()
<=
factors
.
all
()
<=
upper_bounds
.
all
()
# You can test individual routines by typing
# $ python test_grudge.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