feec.polar.examples.utils_congapol#

Utility functions for 2D examples of broken-FEEC discretization on polar domains.

Functions#

add_colorbar(im, ax, **kwargs)

Add a colorbar to the right of an axes.

check_regular_ring_map(map_discrete[, verbose])

Check the first two radial rings of a 2D spline mapping

create_tensor_spline_space(ncells, ...[, ...])

Create a 2D tensor-product spline finite element space on a rectangular logical domain (e.g. with bounds [[0, R], [0, 2*pi]]).

print_map_polar_coeffs(map_discrete)

Used for debugging purposes.

Details#

Utility functions for 2D examples of broken-FEEC discretization on polar domains.

add_colorbar(im, ax, **kwargs)[source]#

Add a colorbar to the right of an axes.

Parameters:
immatplotlib.cm.ScalarMappable

Mappable object associated with the plot

axmatplotlib.axes.Axes

Axes to which the colorbar is attached.

**kwargs

Additional keyword arguments passed to Figure.colorbar.

Returns:
matplotlib.colorbar.Colorbar

The created colorbar.

check_regular_ring_map(map_discrete, verbose=False)[source]#

Check the first two radial rings of a 2D spline mapping

Performs 3 checks: 1. that the pole ring (i=0) collapses to a single point 2. the 1st ring (i=1) has constant radius 3. the 1st ring is uniformly spaced in angle and prints diagnostic information. Used for debugging purposes.

Parameters:
map_discretepsydac.mapping.discrete.SplineMapping

Discrete spline mapping whose coefficients are inspected.

verbosebool, default False

Print diagnostic information if True.

create_tensor_spline_space(ncells, spline_degrees, periodic, bounds, mpi_comm=None)[source]#

Create a 2D tensor-product spline finite element space on a rectangular logical domain (e.g. with bounds [[0, R], [0, 2*pi]]).

Parameters:
ncellssequence of int

Number of cells in 2D spline space in each direction.

spline_degrees: sequence of int

Degree of the spline space in each direction.

periodicsequence of bool

Periodicity of spline space in each direction.

boundssequence of sequence of float

Lower and upper bounds of the logical domain in each direction.

mpi_commmpi4py.MPI.Comm, optional

MPI communicator used for the domain decomposition.

Returns:
TensorFemSpace

The 2D tensor-product spline finite element space.

print_map_polar_coeffs(map_discrete)[source]#

Used for debugging purposes. Prints information about discrete polar coefficients

Parameters:
map_discretepsydac.mapping.discrete.SplineMapping

Discrete spline mapping whose coefficients are inspected.