Ejemplo n.º 1
0
def parametrization_derivative(actx: ArrayContext,
                               dcoll: DiscretizationCollection,
                               dd) -> MultiVector:
    r"""Computes the product of forward metric derivatives spanning the
    tangent space with topological dimension *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
        the product of metric derivatives.
    """
    if dd is None:
        dd = DD_VOLUME

    dim = dcoll.discr_from_dd(dd).dim
    if dim == 0:
        from pymbolic.geometric_algebra import get_euclidean_space

        return MultiVector(_signed_face_ones(actx, dcoll, dd),
                           space=get_euclidean_space(dcoll.ambient_dim))

    from pytools import product

    return product(
        forward_metric_derivative_mv(actx, dcoll, rst_axis, dd)
        for rst_axis in range(dim))
Ejemplo n.º 2
0
def parametrization_derivative(ambient_dim, dim=None, dd=None):
    if dim is None:
        dim = ambient_dim

    if dim == 0:
        from pymbolic.geometric_algebra import get_euclidean_space
        return MultiVector(_SignedFaceOnes(dd),
                space=get_euclidean_space(ambient_dim))

    from pytools import product
    return product(
        forward_metric_derivative_mv(ambient_dim, rst_axis, dd)
        for rst_axis in range(dim))