From 2f720a35169fbe8b1524d466cbe3dbe92799bd88 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 24 May 2021 13:29:02 -0500 Subject: [PATCH] Update grudge.DiscretizationConnection canonical import location --- grudge/discretization.py | 2 ++ grudge/geometry/metrics.py | 58 +++++++++++++++++++------------------- grudge/op.py | 44 ++++++++++++++--------------- 3 files changed, 53 insertions(+), 51 deletions(-) diff --git a/grudge/discretization.py b/grudge/discretization.py index 6fab18f3..ef7aab3c 100644 --- a/grudge/discretization.py +++ b/grudge/discretization.py @@ -45,6 +45,8 @@ __doc__ = """ +.. currentmodule:: grudge + .. autoclass:: DiscretizationCollection """ diff --git a/grudge/geometry/metrics.py b/grudge/geometry/metrics.py index 9bc107d6..07f67bea 100644 --- a/grudge/geometry/metrics.py +++ b/grudge/geometry/metrics.py @@ -88,7 +88,7 @@ def forward_metric_nth_derivative(actx, dcoll, xyz_axis, ref_axes, dd=None): where :math:`\alpha` is a multi-index described by *ref_axes*. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg xyz_axis: an integer denoting which physical coordinate to differentiate. :arg ref_axes: a :class:`tuple` of tuples indicating indices of @@ -142,7 +142,7 @@ def forward_metric_derivative_vector(actx, dcoll, rst_axis, dd=None): of each physical coordinate. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg rst_axis: a :class:`tuple` of tuples indicating indices of coordinate axes of the reference element to the number of derivatives which will be taken. @@ -163,7 +163,7 @@ def forward_metric_derivative_mv(actx, dcoll, rst_axis, dd=None): the forward metric derivatives of each physical coordinate. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg rst_axis: a :class:`tuple` of tuples indicating indices of coordinate axes of the reference element to the number of derivatives which will be taken. @@ -194,9 +194,9 @@ def forward_metric_derivative_mat(actx, dcoll, dim=None, dd=None): a square matrix. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a matrix containing the evaluated forward metric derivatives @@ -233,9 +233,9 @@ def first_fundamental_form(actx, dcoll, dim=None, dd=None): corresponding Jacobian matrix. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a matrix containing coefficients of the first fundamental @@ -254,9 +254,9 @@ def inverse_metric_derivative_mat(actx, dcoll, dim=None, dd=None): the inverse of the Jacobian (forward metric derivative) matrix. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a matrix containing the evaluated inverse metric derivatives. @@ -292,9 +292,9 @@ def inverse_first_fundamental_form(actx, dcoll, dim=None, dd=None): where :math:`E, F, G` are coefficients of the first fundamental form. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a matrix containing coefficients of the inverse of the @@ -329,7 +329,7 @@ def inverse_metric_derivative(actx, dcoll, rst_axis, xyz_axis, dd): reference axis *rst_axis*. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg rst_axis: an integer denoting the reference coordinate axis. :arg xyz_axis: an integer denoting the physical coordinate axis. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. @@ -381,7 +381,7 @@ def inverse_surface_metric_derivative(actx, dcoll, rst_axis, xyz_axis, dd=None): transformation of physical gradients. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg rst_axis: an integer denoting the reference coordinate axis. :arg xyz_axis: an integer denoting the physical coordinate axis. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. @@ -431,9 +431,9 @@ def parametrization_derivative(actx, dcoll, dim, dd): tangent space with topological dimension *dim*. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a :class:`pymbolic.geometric_algebra.MultiVector` containing @@ -460,9 +460,9 @@ def pseudoscalar(actx, dcoll, dim=None, dd=None): metric differentials on a surface. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a :class:`~meshmode.dof_array.DOFArray` containing signed volumes @@ -486,9 +486,9 @@ def area_element(actx, dcoll, dim=None, dd=None): commonly referred to as Jacobian determinants. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: a :class:`~meshmode.dof_array.DOFArray` containing the transformed @@ -508,9 +508,9 @@ def surface_normal(actx, dcoll, dim=None, dd=None): r"""Computes surface normals at each nodal location. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the spatial dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.dim`. + :attr:`grudge.DiscretizationCollection.dim`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :returns: a :class:`~meshmode.dof_array.DOFArray` containing the surface normals at each nodal point. @@ -536,7 +536,7 @@ def mv_normal(actx, dcoll, dd): """Exterior unit normal as a :class:`~pymbolic.geometric_algebra.MultiVector`. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc` as the surface discretization. :returns: a :class:`~pymbolic.geometric_algebra.MultiVector` containing the unit normals. @@ -585,7 +585,7 @@ def normal(actx, dcoll, dd): """Get the unit normal to the specified surface discretization, *dd*. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc` as the surface discretization. :returns: an object array of :class:`~meshmode.dof_array.DOFArray` containing the unit normals at each nodal location. @@ -611,9 +611,9 @@ def second_fundamental_form(actx, dcoll, dim=None, dd=None): surface, and :math:`u,v` are coordinates on the parameterized surface. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the surface dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.ambient_dim` - 1. + :attr:`grudge.DiscretizationCollection.ambient_dim` - 1. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :returns: a rank-2 object array describing second fundamental form. """ @@ -661,9 +661,9 @@ def shape_operator(actx, dcoll, dim=None, dd=None): coordinates on the parameterized surface. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the surface dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.ambient_dim` - 1. + :attr:`grudge.DiscretizationCollection.ambient_dim` - 1. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :returns: a rank-2 object array describing the shape operator. """ @@ -689,9 +689,9 @@ def summed_curvature(actx, dcoll, dim=None, dd=None): operator. :arg actx: an :class:`~arraycontext.context.ArrayContext`. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting the surface dimension. Defaults to the - :attr:`grudge.discretization.DiscretizationCollection.ambient_dim` - 1. + :attr:`grudge.DiscretizationCollection.ambient_dim` - 1. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :returns: a :class:`~meshmode.dof_array.DOFArray` containing the summed curvature at each nodal coordinate. diff --git a/grudge/op.py b/grudge/op.py index ba5ec00d..2e62301e 100644 --- a/grudge/op.py +++ b/grudge/op.py @@ -150,7 +150,7 @@ def project(dcoll, src, tgt, vec): volume to the boundary, or from the base to the an overintegrated quadrature discretization. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg src: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :arg tgt: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. :arg vec: a :class:`~meshmode.dof_array.DOFArray`. @@ -177,7 +177,7 @@ def project(dcoll, src, tgt, vec): def nodes(dcoll, dd=None): r"""Return the nodes of a discretization. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization. :returns: an object array of :class:`~meshmode.dof_array.DOFArray`\ s. @@ -193,7 +193,7 @@ def nodes(dcoll, dd=None): def normal(dcoll, dd): """Get the unit normal to the specified surface discretization, *dd*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc` as the surface discretization. :returns: an object array of :class:`~meshmode.dof_array.DOFArray`. """ @@ -209,10 +209,10 @@ def h_max_from_volume(dcoll, dim=None, dd=None): elements. This length may not be representative if the elements have very high aspect ratios. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting topological dimension. If *None*, the spatial dimension specified by - :attr:`grudge.discretization.DiscretizationCollection.dim` is used. + :attr:`grudge.DiscretizationCollection.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 maximum characteristic length. @@ -237,10 +237,10 @@ def h_min_from_volume(dcoll, dim=None, dd=None): elements. This length may not be representative if the elements have very high aspect ratios. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dim: an integer denoting topological dimension. If *None*, the spatial dimension specified by - :attr:`grudge.discretization.DiscretizationCollection.dim` is used. + :attr:`grudge.DiscretizationCollection.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. @@ -308,7 +308,7 @@ def local_grad(dcoll, vec, *, nested=False): r"""Return the element-local gradient of the volume function represented by *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or object array of :class:`~meshmode.dof_array.DOFArray`\ s. :arg nested: return nested object arrays instead of a single multidimensional @@ -332,7 +332,7 @@ def local_d_dx(dcoll, xyz_axis, vec): r"""Return the element-local derivative along axis *xyz_axis* of the volume function represented by *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg xyz_axis: an integer indicating the axis along which the derivative is taken. :arg vec: a :class:`~meshmode.dof_array.DOFArray`. @@ -368,7 +368,7 @@ def local_div(dcoll, vecs): r"""Return the element-local divergence of the vector volume function represented by *vecs*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: an object array of a :class:`~meshmode.dof_array.DOFArray`\ s, where the last axis of the array must have length @@ -473,7 +473,7 @@ def weak_local_grad(dcoll, *args, nested=False): May be called with ``(vecs)`` or ``(dd, vecs)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization if not provided. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or object array of @@ -513,7 +513,7 @@ def weak_local_d_dx(dcoll, *args): May be called with ``(xyz_axis, vecs)`` or ``(dd, xyz_axis, vecs)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg xyz_axis: an integer indicating the axis along which the derivative is taken :arg vec: a :class:`~meshmode.dof_array.DOFArray`. @@ -538,7 +538,7 @@ def weak_local_div(dcoll, *args): May be called with ``(vecs)`` or ``(dd, vecs)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization if not provided. :arg vec: a object array of @@ -644,7 +644,7 @@ def mass(dcoll, *args): May be called with ``(vec)`` or ``(dd, vec)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization if not provided. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or object array of @@ -757,7 +757,7 @@ def inverse_mass(dcoll, vec): :class:`~meshmode.dof_array.DOFArray`\ s, the inverse mass operator is applied in the Kronecker sense (component-wise). - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or object array of :class:`~meshmode.dof_array.DOFArray`\ s. :returns: a :class:`~meshmode.dof_array.DOFArray` denoting the @@ -929,7 +929,7 @@ def face_mass(dcoll, *args): May be called with ``(vec)`` or ``(dd, vec)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base 'all_faces' discretization if not provided. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or object array of @@ -974,7 +974,7 @@ def norm(dcoll, vec, p, dd=None): r"""Return the vector p-norm of a function represented by its vector of degrees of freedom *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray` or an object array of a :class:`~meshmode.dof_array.DOFArray`\ s, where the last axis of the array must have length @@ -1015,7 +1015,7 @@ def nodal_sum(dcoll, dd, vec): def nodal_summation(dcoll, vec): r"""Return the nodal sum of a vector of degrees of freedom *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray`. :returns: an integer denoting the nodal sum. """ @@ -1034,7 +1034,7 @@ def nodal_min(dcoll, dd, vec): def nodal_minimum(dcoll, vec): r"""Return the nodal minimum of a vector of degrees of freedom *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray`. :returns: an integer denoting the nodal minimum. """ @@ -1054,7 +1054,7 @@ def nodal_max(dcoll, dd, vec): def nodal_maximum(dcoll, vec): r"""Return the nodal maximum of a vector of degrees of freedom *vec*. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray`. :returns: an integer denoting the nodal maximum. """ @@ -1068,7 +1068,7 @@ def integral(dcoll, vec, dd=None): """Numerically integrates a function represented by a :class:`~meshmode.dof_array.DOFArray` of degrees of freedom. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg vec: a :class:`~meshmode.dof_array.DOFArray` :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization if not provided. @@ -1113,7 +1113,7 @@ def elementwise_sum(dcoll, *args): May be called with ``(dcoll, vec)`` or ``(dcoll, dd, vec)``. - :arg dcoll: a :class:`grudge.discretization.DiscretizationCollection`. + :arg dcoll: a :class:`grudge.DiscretizationCollection`. :arg dd: a :class:`~grudge.dof_desc.DOFDesc`, or a value convertible to one. Defaults to the base volume discretization if not provided. :arg vec: a :class:`~meshmode.dof_array.DOFArray`