Discretization Collection

grudge.discretization.DiscretizationTag

alias of type[_DiscretizationTag]

class grudge.DiscretizationCollection(array_context: ArrayContext, volume_discrs: Mesh | Mapping[Hashable, Discretization], order: int | None = None, discr_tag_to_group_factory: Mapping[type[_DiscretizationTag], ElementGroupFactory] | None = None, mpi_communicator: mpi4py.MPI.Intracomm | None = None)[source]

A collection of discretizations, defined on the same underlying Mesh, corresponding to various mesh entities (volume, interior facets, boundaries) and associated element groups.

Note

Do not call the constructor directly. Use make_discretization_collection() instead.

dim

Return the topological dimension.

ambient_dim

Return the dimension of the ambient space.

real_dtype

Return the data type used for real-valued arithmetic.

complex_dtype

Return the data type used for complex-valued arithmetic.

discr_from_dd(dd: Any) Discretization[source]

Provides a meshmode.discretization.Discretization object from dd.

connection_from_dds(from_dd: Any, to_dd: Any) DiscretizationConnection[source]

Provides a mapping (connection) from one discretization to another, e.g. from the volume to the boundary, or from the base to the an overintegrated quadrature discretization, or from a nodal representation to a modal representation.

Parameters:
  • from_dd – a DOFDesc, or a value convertible to one.

  • to_dd – a DOFDesc, or a value convertible to one.

empty(array_context: ArrayContext, dtype=None, *, dd: DOFDesc | None = None) DOFArray[source]

Return an empty DOFArray defined at the volume nodes: grudge.dof_desc.DD_VOLUME_ALL.

Parameters:
  • array_context – an ArrayContext.

  • dtype – type special value ‘c’ will result in a vector of dtype complex_dtype. If None (the default), a real vector will be returned.

zeros(array_context: ArrayContext, dtype=None, *, dd: DOFDesc | None = None) DOFArray[source]

Return a zero-initialized DOFArray defined at the volume nodes, grudge.dof_desc.DD_VOLUME_ALL.

Parameters:
  • array_context – an ArrayContext.

  • dtype – type special value ‘c’ will result in a vector of dtype complex_dtype. If None (the default), a real vector will be returned.

nodes(dd=None)[source]

Return the nodes of a discretization specified by dd.

Parameters:

dd – a DOFDesc, or a value convertible to one. Defaults to the base volume discretization.

Returns:

an object array of frozen DOFArrays

normal(dd)[source]

Get the unit normal to the specified surface discretization, dd.

Parameters:

dd – a DOFDesc as the surface discretization.

Returns:

an object array of frozen DOFArrays.

Internal functionality

_base_to_geoderiv_connection(dd: DOFDesc) DiscretizationConnection[source]

The “geometry derivatives” discretization for a given dd is typically identical to the one returned by discr_from_dd(), however for affinely-mapped simplicial elements, it will use a \(P^0\) discretization having a single DOF per element. As a result, DOFArrays on this are broadcast-compatible with the discretizations returned by discr_from_dd().

This is an internal function, not intended for use outside grudge.

grudge.make_discretization_collection(array_context: ArrayContext, volumes: Mesh | Mapping[Hashable, Mesh], order: int | None = None, discr_tag_to_group_factory: Mapping[type[_DiscretizationTag], ElementGroupFactory] | None = None) DiscretizationCollection[source]
Parameters:

discr_tag_to_group_factory – A mapping from discretization tags (typically one of: DISCR_TAG_BASE, DISCR_TAG_MODAL, or DISCR_TAG_QUAD) to a ElementGroupFactory indicating with which type of discretization the operations are to be carried out, or None to indicate that operations with this discretization tag should be carried out with the standard volume discretization.

Note

If passing a Discretization in volumes, it must be nodal and unisolvent, consistent with DISCR_TAG_BASE.

Note

To use the resulting DiscretizationCollection in a distributed-memory manner, the array_context passed in must be one of the distributed-memory array contexts from grudge.array_context. Unlike the (now-deprecated, for direct use) constructor of DiscretizationCollection, this function no longer accepts a separate MPI communicator.

Note

If the resulting DiscretizationCollection is distributed across multiple ranks, then this is an MPI-collective operation, i.e. all ranks in the communicator must enter this function at the same time.