pysdic.remap_vertices_coordinates#
- remap_vertices_coordinates(vertices_coordinates, connectivity, element_indices, *, skip_m1=True, default=nan)[source]#
Remap the global coordinates of the vertices to given integration points within elements based on the element connectivity, and the remapped coordinates will have shape \((N_{p}, N_{vpe}, E)\).
remapped_coordinates[i]contains the global coordinates of the vertices for the element containing integration point \(i\).Note
Input
vertices_coordinateswill be converted tonumpy.float64.Inputs
connectivityandelement_indiceswill be converted tonumpy.int64.
Warning
No tests are performed to check if the inputs array are consistent (e.g., if the connectivity contains invalid vertex indices, …). Only shapes are validated. The behavior of the function is undefined in this case.
Important
When using
-1inelement_indicesfor invalid elements, ensure to setskip_m1toTrueto avoid indexing errors.- Parameters:
vertices_coordinates (ArrayLike) – An array of shape \((N_{v}, E)\) containing the global coordinates of the vertices in the mesh.
connectivity (ArrayLike) – An array of shape \((N_{e}, N_{vpe})\) defining the connectivity of the elements in the mesh, where each row contains the indices of the nodes that form an element.
element_indices (ArrayLike) – An array of shape \((N_{p},)\) containing the indices of each element corresponding to the \(N_{p}\) integration points.
skip_m1 (
bool, optional) – If set toTrue, any element index of -1 inelement_indiceswill result in the corresponding remapped coordinates being set todefault. Default isTrue.default (Real, optional) – The default value to assign to remapped coordinates for integration points associated with an element index of -1 when
skip_m1isTrue. Default isnumpy.nan.
- Returns:
remapped_coordinates – An array of shape \((N_{p}, N_{vpe}, E)\) containing the remapped global coordinates of the vertices for each integration point within the elements.
- Return type:
Notes
In a space of dimension \(E\) with a mesh constituted of \(N_{e}\) elements and \(N_{v}\) nodes. The mesh is composed of \(K\)-dimensional elements (with \(K \leq E\)) defined by \(N_{vpe}\) nodes for each element.
For a given set of \(N_{p}\) integration points located within elements, the remapped coordinates array has shape \((N_{p}, N_{vpe}, E)\) where each entry corresponds to the global coordinates of the nodes associated with the element containing the integration point.
See also
pysdic.assemble_jacobian_matrixTo compute the Jacobian matrices for the transformation between natural and global coordinates.
Examples
Lets construct a simple 2D mesh and remap the vertex coordinates to given integration points for triangular elements.
1import numpy 2from pysdic import remap_vertices_coordinates 3 4vertices_coordinates = numpy.array( 5 [[0.0, 0.0], 6 [1.0, 0.0], 7 [1.0, 1.0], 8 [0.0, 1.0]] 9) 10 11connectivity = numpy.array( 12 [[0, 1, 2], 13 [0, 2, 3]] 14) 15 16natural_coordinates = numpy.array( 17 [[0.2, 0.3], 18 [0.6, 0.2]] 19) 20 21element_indices = numpy.array([0, 1, 0]) 22 23remapped_coords = remap_vertices_coordinates( 24 vertices_coordinates=vertices_coordinates, 25 connectivity=connectivity, 26 element_indices=element_indices 27) 28 29print(f"remapped coordinates (shape={remapped_coords.shape}):") 30print(remapped_coords)
remapped coordinates (shape=(3, 3, 2)): [[[0. 0.] [1. 0.] [1. 1.]] [[0. 0.] [1. 1.] [0. 1.]]] [[0. 0.] [1. 0.] [1. 1.]]]