Discretizations

Abstract interface

class meshmode.discretization.ElementGroupBase(mesh_el_group, order, index)

Container for the Discretization data corresponding to one meshmode.mesh.MeshElementGroup.

mesh_el_group
order
index
nelements
nunit_dofs

The number of (for now: nodal) degrees of freedom (“DOFs”) associated with a single element.

ndofs

The total number of (for now: nodal) degrees of freedom (“DOFs”) associated with the element group.

dim
unit_nodes()

Returns a numpy.ndarray of shape (dim, nunit_dofs) of reference coordinates of interpolation nodes.

weights()

Returns an array of length nunit_dofs containing quadrature weights.

is_affine

A bool flag that is True if the local-to-global parametrization of all the elements in the group is affine. Based on meshmode.mesh.MeshElementGroup.is_affine.

class meshmode.discretization.InterpolatoryElementGroupBase(mesh_el_group, order, index)

A subclass of ElementGroupBase that is equipped with a function space.

basis()

Returns a list of basis functions that take arrays of shape (dim, n) and return an array of shape (n,)`` (which performs evaluation of the basis function).

grad_basis()
Returns

a tuple of functions, each of which accepts arrays of shape (dims, npts) and returns a tuple of length dims containing the derivatives along each axis as an array of size npts. ‘Scalar’ evaluation, by passing just one vector of length dims, is also supported.

diff_matrices()

Return a dim-long tuple of matrices of shape (nunit_nodes, nunit_nodes), each of which, when applied to an array of nodal values, take derivatives in the reference (r,s,t) directions.

class meshmode.discretization.ElementGroupFactory
__call__(mesh_ele_group, node_nr_base)
class meshmode.discretization.Discretization(actx: meshmode.array_context.ArrayContext, mesh, group_factory, real_dtype=<class 'numpy.float64'>)

An unstructured composite discretization.

real_dtype
complex_dtype
mesh
dim
ambient_dim
ndofs
groups
empty(actx: meshmode.array_context.ArrayContext, dtype=None)

Return an empty DOFArray.

Parameters

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

zeros(actx: meshmode.array_context.ArrayContext, dtype=None)

Return a zero-initialized DOFArray.

Parameters

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

empty_like(array: meshmode.dof_array.DOFArray)
zeros_like(array: meshmode.dof_array.DOFArray)
nodes()
Returns

object array of shape (ambient_dim,) containing DOFArrays of node coordinates.

num_reference_derivative(ref_axes, vec)
quad_weights()
Returns

A DOFArray with quadrature weights.

Element Groups for Composite Polynomial Discretization

Group types

class meshmode.discretization.poly_element.InterpolatoryQuadratureSimplexElementGroup(mesh_el_group, order, index)

Elemental discretization supplying a high-order quadrature rule with a number of nodes matching the number of polynomials in \(P^k\), hence usable for differentiation and interpolation.

No interpolation nodes are present on the boundary of the simplex.

class meshmode.discretization.poly_element.QuadratureSimplexElementGroup(mesh_el_group, order, index)

Elemental discretization supplying a high-order quadrature rule with a number of nodes which does not necessarily match the number of polynomials in \(P^k\). This discretization therefore excels at quadarature, but is not necessarily usable for interpolation.

No interpolation nodes are present on the boundary of the simplex.

class meshmode.discretization.poly_element.PolynomialWarpAndBlendElementGroup(mesh_el_group, order, index)

Elemental discretization with a number of nodes matching the number of polynomials in \(P^k\), hence usable for differentiation and interpolation. Interpolation nodes edge-clustered for avoidance of Runge phenomena. Nodes are present on the boundary of the simplex.

class meshmode.discretization.poly_element.PolynomialEquidistantSimplexElementGroup(mesh_el_group, order, index)

Elemental discretization with a number of nodes matching the number of polynomials in \(P^k\), hence usable for differentiation and interpolation. Interpolation nodes are present on the boundary of the simplex.

New in version 2016.1.

class meshmode.discretization.poly_element.LegendreGaussLobattoTensorProductElementGroup(mesh_el_group, order, index)

Group factories

class meshmode.discretization.poly_element.InterpolatoryQuadratureSimplexGroupFactory(order)
class meshmode.discretization.poly_element.QuadratureSimplexGroupFactory(order)
class meshmode.discretization.poly_element.PolynomialWarpAndBlendGroupFactory(order)
class meshmode.discretization.poly_element.PolynomialEquidistantSimplexGroupFactory(order)

New in version 2016.1.

class meshmode.discretization.poly_element.LegendreGaussLobattoTensorProductGroupFactory(order)

Visualization

meshmode.discretization.visualization.make_visualizer(actx, discr, vis_order, element_shrink_factor=None)
class meshmode.discretization.visualization.Visualizer(connection, element_shrink_factor=None)
show_scalar_in_mayavi(field, **kwargs)
show_scalar_in_matplotlib_3d(field, **kwargs)
write_vtk_file(file_name, names_and_fields, compressor=None, real_only=False, overwrite=False)
meshmode.discretization.visualization.write_nodal_adjacency_vtk_file(file_name, mesh, compressor=None, overwrite=False)