mapping.discrete#

Functions#

random_string(n)

Classes#

Inheritance diagram of psydac.mapping.discrete

NurbsMapping(*args, **kwargs)

SplineMapping(*args, **kwargs)

Details#

class SplineMapping(*args: Any, **kwargs: Any)[source]#

Bases: BasicCallableMapping

property name#
set_name(name)[source]#
classmethod from_mapping(tensor_space, mapping)[source]#
classmethod from_control_points(tensor_space, control_points)[source]#
jacobian(*eta)[source]#
jacobian_inv(*eta)[source]#
metric(*eta)[source]#
metric_det(*eta)[source]#
property ldim#
property pdim#
build_mesh(grid, npts_per_cell=None, overlap=0)[source]#

Evaluation of the mapping on the given grid.

Parameters:
gridList of ndarray

Grid on which to evaluate the fields. Each array in this list corresponds to one logical coordinate.

npts_per_cell: int, tuple of int or None, optional

Number of evaluation points in each cell. If an integer is given, then assume that it is the same in every direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
mesh: tuple

ldim ldim-D arrays. One for each component.

See also

psydac.fem.tensor.TensorFemSpace.eval_fields

More information about the grid parameter.

jac_mat_grid(grid, npts_per_cell=None, overlap=0)[source]#

Evaluates the Jacobian matrix of the mapping at the given location(s) grid.

Parameters:
gridList of array_like

Grid on which to evaluate the fields

npts_per_cell: int or tuple of int or None, optional

number of evaluation points in each cell. If an integer is given, then assume that it is the same in every direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
array_like

Jacobian matrix at the location(s) grid.

See also

mapping.SplineMapping.inv_jac_mat_grid

Evaluates the inverse of the Jacobian matrix of the mapping at the given location(s) grid.

mapping.SplineMapping.metric_det_grid

Evaluates the metric determinant of the mapping at the given location(s) grid.

jac_mat_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian matrix on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

jac_mat_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian matrix on an irregular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

inv_jac_mat_grid(grid, npts_per_cell=None, overlap=0)[source]#

Evaluates the inverse of the Jacobian matrix of the mapping at the given location(s) grid.

Parameters:
gridList of array_like

Grid on which to evaluate the fields

npts_per_cell: int or tuple of int or None, optional

number of evaluation points in each cell. If an integer is given, then assume that it is the same in every direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
array_like

Inverse of the Jacobian matrix at the location(s) grid.

See also

mapping.SplineMapping.jac_mat_grid

Evaluates the Jacobian matrix of the mapping at the given location(s) grid.

mapping.SplineMapping.metric_det_grid

Evaluates the metric determinant of the mapping at the given location(s) grid.

inv_jac_mat_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the inverse of the Jacobian matrix on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
inv_jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the inverse of the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

inv_jac_mat_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the inverse of the Jacobian matrix on an irregular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
inv_jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the inverse of the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

jac_det_grid(grid, npts_per_cell=None, overlap=0)[source]#

Evaluates the Jacobian determinant of the mapping at the given location(s) grid.

Parameters:
gridList of array_like

Grid on which to evaluate the fields

npts_per_cell: int or tuple of int or None, optional

number of evaluation points in each cell. If an integer is given, then assume that it is the same in every direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
array_like

Jacobian determinant at the location(s) grid.

See also

mapping.SplineMapping.jac_mat_grid

Evaluates the Jacobian matrix of the mapping at the given location(s) grid.

mapping.SplineMapping.inv_jac_mat_grid

Evaluates the inverse of the Jacobian matrix of the mapping at the given location(s) grid.

jac_det_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian determinant on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_detsndarray

self.ldim D array of shape (n_x_1, ..., n_x_ldim). jac_dets[x_1, ..., x_ldim] is the Jacobian determinant at the location corresponding to (x_1, ..., x_ldim).

jac_det_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian determinant on an irregular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_detsndarray

self.ldim D array of shape (n_x_1, ..., n_x_ldim). jac_dets[x_1, ..., x_ldim] is the Jacobian determinant at the location corresponding to (x_1, ..., x_ldim).

jacobian_det(*eta)[source]#
property space#
property fields#
property control_points#
export(filename)[source]#

Export tensor-product spline space and mapping to geometry file in HDF5 format (single-patch only).

Parameters:
filenamestr

Name of HDF5 output file.

class ControlPoints(mapping)[source]#

Bases: object

Convenience object to access control points.

property mapping#
class NurbsMapping(*args: Any, **kwargs: Any)[source]#

Bases: SplineMapping

classmethod from_control_points_weights(tensor_space, control_points, weights)[source]#
jacobian(*eta)[source]#
build_mesh(grid, npts_per_cell=None, overlap=0)[source]#

Evaluation of the mapping on the given grid.

Parameters:
gridList of ndarray

Each array in the list should correspond to a logical coordinate.

npts_per_cellint, tuple of int or None, optional
overlapint

How much to overlap. Only used in the distributed context.

Returns:
mesh: tuple

ldim ldim-D arrays. One for each component.

See also

psydac.fem.tensor.TensorFemSpace.eval_fields

More information about the grid parameter.

jac_mat_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian matrix on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

jac_mat_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian matrix on an irregular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

inv_jac_mat_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the inverse of the Jacobian matrix on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
inv_jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the inverse of the Jacobian matrix a at the location corresponding to (x_1, ..., x_ldim).

inv_jac_mat_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the inverse of the Jacobian matrix on an irregular tensor product grid.

Parameters:
gridList of ndarray

List of 1D arrays representing each direction of the grid.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
inv_jac_matsndarray

self.ldim + 2 D array of shape (n_x_1, ..., n_x_ldim, ldim, ldim). jac_mats[x_1, ..., x_ldim] is the inverse of the Jacobian matrix at the location corresponding to (x_1, ..., x_ldim).

jac_det_regular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian determinant on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_detsndarray

self.ldim D array of shape (n_x_1, ..., n_x_ldim). jac_dets[x_1, ..., x_ldim] is the Jacobian determinant at the location corresponding to (x_1, ..., x_ldim).

jac_det_irregular_tensor_grid(grid, overlap=0)[source]#

Evaluates the Jacobian determinant on a regular tensor product grid.

Parameters:
gridList of ndarray

List of 2D arrays representing each direction of the grid. Each of these arrays should have shape (ne_xi, nv_xi) where ne_xi is the number of cells in the domain in the direction xi and nv_xi is the number of evaluation points in the same direction.

overlapint

How much to overlap. Only used in the distributed context.

Returns:
jac_detsndarray

self.ldim D array of shape (n_x_1, ..., n_x_ldim). jac_dets[x_1, ..., x_ldim] is the Jacobian determinant at the location corresponding to (x_1, ..., x_ldim).

property weights_field#
property weights#
export(filename)[source]#

Export tensor-product spline space and mapping to geometry file in HDF5 format (single-patch only).

Parameters:
filenamestr

Name of HDF5 output file.

class Weights(mapping)[source]#

Bases: object

Convenience object to access weights.

property mapping#