meshes.mesh Module

Provides the data structure for approximating the spatial domain of the partial differential equation.

class pysofe.meshes.mesh.Mesh(nodes, connectivity)[source]

Provides a class for general meshes.

Basically clues together the MeshGeometry and MeshTopology classes and provides interfaces for mesh refinement and function evaluation.

Parameters:
  • nodes (array_like) – The coordinates of the mesh nodes
  • connectivity (array_like) – The connectivity array defining the mesh cells via their vertex indices
dimension

The spatial dimension fo the mesh.

nodes

The coordinates of the mesh nodes.

cells

The incident vertex indices of the mesh cells.

facets

The incident vertex indices of the mesh facets.

faces

The incident vertex indices of the mesh faces.

edges

The incident vertex indices of the mesh edges.

boundary(fnc=None)[source]

Determines the mesh facets that are part of the boundary specified by the function fnc and returns a corresponding boolean array.

Parameters:fnc (callable) – Function specifying some part of the boundary for which to return the corresponding facets
refine(method='uniform', **kwargs)[source]

Refines the mesh using the given method.

Parameters:method (str) – A string specifying the refinement method to use
eval_function(fnc, points)[source]

Evaluates a given function in the global mesh points corresponding to the given local points on the reference domain.

Parameters:
  • fnc (callable) – The function to evaluate
  • points (array_like) – The local points on the reference domain
Returns:

nE x nP [x ...]

Return type:

numpy.ndarray

class pysofe.meshes.mesh.UnitSquareMesh(nx=10, ny=10)[source]

Discretizes the domain of the unit square in 2D.

Parameters:
  • nx (int) – Number of nodes in the x-direction
  • ny (int) – Number of nodes in the y-direction