From 9af966c7edac6bf76bc19b65660275656e247b8f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 15 Apr 2021 18:22:31 -0500 Subject: [PATCH] In grudge.op: rename el-local derivatives to include 'local' --- examples/wave/wave-op-mpi.py | 4 +-- examples/wave/wave-op-var-velocity.py | 4 +-- examples/wave/wave-op.py | 4 +-- grudge/eager.py | 12 +++---- grudge/op.py | 47 ++++++++++++++------------- 5 files changed, 36 insertions(+), 35 deletions(-) diff --git a/examples/wave/wave-op-mpi.py b/examples/wave/wave-op-mpi.py index 19193ca0..f02770e1 100644 --- a/examples/wave/wave-op-mpi.py +++ b/examples/wave/wave-op-mpi.py @@ -74,8 +74,8 @@ def wave_operator(discr, c, w): return ( op.inverse_mass(discr, flat_obj_array( - -c*op.weak_div(discr, v), - -c*op.weak_grad(discr, u) + -c*op.weak_local_div(discr, v), + -c*op.weak_local_grad(discr, u) ) + # noqa: W504 op.face_mass(discr, diff --git a/examples/wave/wave-op-var-velocity.py b/examples/wave/wave-op-var-velocity.py index 496b1802..f1af8045 100644 --- a/examples/wave/wave-op-var-velocity.py +++ b/examples/wave/wave-op-var-velocity.py @@ -88,8 +88,8 @@ def wave_operator(discr, c, w): return ( op.inverse_mass(discr, flat_obj_array( - -op.weak_div(discr, dd_quad, c_quad*v_quad), - -op.weak_grad(discr, dd_quad, c_quad*u_quad) + -op.weak_local_div(discr, dd_quad, c_quad*v_quad), + -op.weak_local_grad(discr, dd_quad, c_quad*u_quad) ) + # noqa: W504 op.face_mass(discr, diff --git a/examples/wave/wave-op.py b/examples/wave/wave-op.py index cac70d6b..4af7c81c 100644 --- a/examples/wave/wave-op.py +++ b/examples/wave/wave-op.py @@ -72,8 +72,8 @@ def wave_operator(discr, c, w): return ( op.inverse_mass(discr, flat_obj_array( - -c*op.weak_div(discr, v), - -c*op.weak_grad(discr, u) + -c*op.weak_local_div(discr, v), + -c*op.weak_local_grad(discr, u) ) + # noqa: W504 op.face_mass(discr, diff --git a/grudge/eager.py b/grudge/eager.py index 516b5629..5bf72f08 100644 --- a/grudge/eager.py +++ b/grudge/eager.py @@ -50,22 +50,22 @@ class EagerDGDiscretization(DGDiscretizationWithBoundaries): return op.normal(self, dd) def grad(self, vec): - return op.grad(self, vec) + return op.local_grad(self, vec) def d_dx(self, xyz_axis, vec): - return op.d_dx(self, xyz_axis, vec) + return op.local_d_dx(self, xyz_axis, vec) def div(self, vecs): - return op.d_dx(self, vecs) + return op.local_d_dx(self, vecs) def weak_grad(self, *args): - return op.weak_grad(self, *args) + return op.weak_local_grad(self, *args) def weak_d_dx(self, *args): - return op.weak_d_dx(self, *args) + return op.weak_local_d_dx(self, *args) def weak_div(self, *args): - return op.weak_div(self, *args) + return op.weak_local_div(self, *args) def mass(self, *args): return op.mass(self, *args) diff --git a/grudge/op.py b/grudge/op.py index c763f2bc..a04f9571 100644 --- a/grudge/op.py +++ b/grudge/op.py @@ -2,13 +2,13 @@ .. autofunction:: project .. autofunction:: nodes -.. autofunction:: grad -.. autofunction:: d_dx -.. autofunction:: div +.. autofunction:: local_grad +.. autofunction:: local_d_dx +.. autofunction:: local_div -.. autofunction:: weak_grad -.. autofunction:: weak_d_dx -.. autofunction:: weak_div +.. autofunction:: weak_local_grad +.. autofunction:: weak_local_d_dx +.. autofunction:: weak_local_div .. autofunction:: normal .. autofunction:: mass @@ -133,8 +133,9 @@ def _bound_grad(discrwb): return bind(discrwb, sym.nabla(discrwb.dim) * sym.Variable("u"), local_only=True) -def grad(discrwb, vec): - r"""Return the gradient of the volume function represented by *vec*. +def local_grad(discrwb, vec): + r"""Return the element-local gradient of the volume function represented by + *vec*. :arg vec: a :class:`~meshmode.dof_array.DOFArray` :returns: an object array of :class:`~meshmode.dof_array.DOFArray`\ s @@ -148,9 +149,9 @@ def _bound_d_dx(discrwb, xyz_axis): local_only=True) -def d_dx(discrwb, xyz_axis, vec): - r"""Return the derivative along axis *xyz_axis* of the volume function - represented by *vec*. +def local_d_dx(discrwb, xyz_axis, vec): + r"""Return the element-local derivative along axis *xyz_axis* of the volume + function represented by *vec*. :arg xyz_axis: an integer indicating the axis along which the derivative is taken @@ -179,8 +180,8 @@ def _div_helper(discrwb, diff_func, vecs): return result -def div(discrwb, vecs): - r"""Return the divergence of the vector volume function +def local_div(discrwb, vecs): + r"""Return the element-local divergence of the vector volume function represented by *vecs*. :arg vec: an object array of @@ -191,7 +192,7 @@ def div(discrwb, vecs): """ return _div_helper(discrwb, - lambda i, subvec: d_dx(discrwb, i, subvec), + lambda i, subvec: local_d_dx(discrwb, i, subvec), vecs) @@ -202,9 +203,9 @@ def _bound_weak_grad(discrwb, dd): local_only=True) -def weak_grad(discrwb, *args): - r"""Return the "weak gradient" of the volume function represented by - *vec*. +def weak_local_grad(discrwb, *args): + r"""Return the element-local weak gradient of the volume function + represented by *vec*. May be called with ``(vecs)`` or ``(dd, vecs)``. @@ -232,9 +233,9 @@ def _bound_weak_d_dx(discrwb, dd, xyz_axis): local_only=True) -def weak_d_dx(discrwb, *args): - r"""Return the derivative along axis *xyz_axis* of the volume function - represented by *vec*. +def weak_local_d_dx(discrwb, *args): + r"""Return the element-local weak derivative along axis *xyz_axis* of the + volume function represented by *vec*. May be called with ``(xyz_axis, vecs)`` or ``(dd, xyz_axis, vecs)``. @@ -254,8 +255,8 @@ def weak_d_dx(discrwb, *args): return _bound_weak_d_dx(discrwb, dd, xyz_axis)(u=vec) -def weak_div(discrwb, *args): - r"""Return the "weak divergence" of the vector volume function +def weak_local_div(discrwb, *args): + r"""Return the element-local weak divergence of the vector volume function represented by *vecs*. May be called with ``(vecs)`` or ``(dd, vecs)``. @@ -277,7 +278,7 @@ def weak_div(discrwb, *args): raise TypeError("invalid number of arguments") return _div_helper(discrwb, - lambda i, subvec: weak_d_dx(discrwb, dd, i, subvec), + lambda i, subvec: weak_local_d_dx(discrwb, dd, i, subvec), vecs) # }}} -- GitLab