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
2e88c962
Commit
2e88c962
authored
3 years ago
by
Thomas Gibson
Browse files
Options
Downloads
Patches
Plain Diff
Add op.h_min_from_volume routine
parent
9a2ec859
No related branches found
Branches containing commit
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
+31
-4
31 additions, 4 deletions
grudge/op.py
with
31 additions
and
4 deletions
grudge/op.py
+
31
−
4
View file @
2e88c962
...
...
@@ -4,6 +4,7 @@
.. autofunction:: nodes
.. autofunction:: normal
.. autofunction:: h_max_from_volume
.. autofunction:: h_min_from_volume
.. autofunction:: local_grad
.. autofunction:: local_d_dx
...
...
@@ -157,16 +158,16 @@ def normal(dcoll, dd):
@memoize_on_first_arg
def
h_max_from_volume
(
dcoll
,
dim
=
None
,
dd
=
None
):
"""
Returns a characteristic length based on the volume of the
elements.
This length may not be representative if the elements have very
high
aspect ratios.
"""
Returns a
(maximum)
characteristic length based on the volume of the
elements.
This length may not be representative if the elements have very
high
aspect ratios.
:arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`.
:arg dim: an integer denoting topological dimension. If *None*, the
spatial dimension specified by :attr:`dcoll.dim` is used.
:arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one.
Defaults to the base volume discretization if not provided.
:returns: an integer denoting the characteristic length.
:returns: an integer denoting the
maximum
characteristic length.
"""
if
dd
is
None
:
dd
=
dof_desc
.
DD_VOLUME
...
...
@@ -180,6 +181,32 @@ def h_max_from_volume(dcoll, dim=None, dd=None):
dcoll
,
dd
,
elementwise_sum
(
dcoll
,
mass
(
dcoll
,
dd
,
ones_volm
))
)
**
(
1.0
/
dim
)
@memoize_on_first_arg
def
h_min_from_volume
(
dcoll
,
dim
=
None
,
dd
=
None
):
"""
Returns a (minimum) characteristic length based on the volume of the
elements. This length may not be representative if the elements have very
high aspect ratios.
:arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`.
:arg dim: an integer denoting topological dimension. If *None*, the
spatial dimension specified by :attr:`dcoll.dim` is used.
:arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one.
Defaults to the base volume discretization if not provided.
:returns: an integer denoting the minimum characteristic length.
"""
if
dd
is
None
:
dd
=
dof_desc
.
DD_VOLUME
dd
=
dof_desc
.
as_dofdesc
(
dd
)
if
dim
is
None
:
dim
=
dcoll
.
dim
ones_volm
=
dcoll
.
_volume_discr
.
zeros
(
dcoll
.
_setup_actx
)
+
1.0
return
nodal_min
(
dcoll
,
dd
,
elementwise_sum
(
dcoll
,
mass
(
dcoll
,
dd
,
ones_volm
))
)
**
(
1.0
/
dim
)
# }}}
...
...
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