weac.plot module

Plotting resources for the WEak Layer AntiCrack nucleation model.

class weac.plot.MidpointNormalize(vmin, vmax, midpoint=0, clip=False)[source]

Bases: Normalize

Colormap normalization to a specified midpoint. Default is 0.

weac.plot.adjust_lightness(color, amount=0.5)[source]

Adjust color lightness.

Parameters:
  • color (str or tuple) – Matplotlib colorname, hex string, or RGB value tuple.

  • amount (float, optional) – Amount of lightening: >1 lightens, <1 darkens. Default is 0.5.

Returns:

RGB color tuple.

Return type:

tuple

weac.plot.deformed(instance, xsl, xwl, z, phi, dz=2, scale=100, window=inf, pad=2, levels=300, aspect=2, field='principal', normalize=True, dark=False, filename='cont')[source]

Plot 2D deformed solution with displacement or stress fields.

Parameters:
  • instance (object) – Instance of layered class.

  • xsl (ndarray) – Discretized slab x-coordinates (mm).

  • xwl (ndarray) – Discretized weak-layer x-coordinates (mm).

  • z (ndarray) – Solution vectors at positions x as columns of matrix z.

  • phi (float) – Inclination (degrees). Counterclockwise positive.

  • dz (float, optional) – Element size along z-axis (mm) for stress plot. Default is 2 mm.

  • scale (int, optional) – Scaling factor for the visualization of displacements. Default is 100.

  • window (int, optional) – Plot window (cm) around maximum vertical deflection. Default is inf (full view).

  • pad (float, optional) – Padding around shown geometry. Default is 2.

  • levels (int, optional) – Number of isolevels. Default is 300.

  • aspect (int, optional) – Aspect ratio of the displayed geometry. 1 is true to scale. Default is 2.

  • field ({'u', 'w', 'Sxx', 'Txz', 'Szz', 'principal'}, optional) – Field quantity for contour plot. Axial deformation ‘u’, vertical deflection ‘w’, axial normal stress ‘Sxx’, shear stress ‘Txz’, transverse normal stress ‘Szz’, or principal stresses ‘principal’.

  • normalize (bool, optional) – Toggle layerwise normalization of principal stresses to respective strength. Only available with field=’principal’. Default is True.

  • dark (bool, optional) – Toggle display on dark figure background. Default is False.

Raises:

ValueError – If invalid stress or displacement field is requested.

weac.plot.displacements(instance, x, z, i='', **segments)[source]

Wrap for dispalcements plot.

weac.plot.err_comp(da, Gdif, Ginc, mode=0)[source]

Wrap energy release rate plot.

weac.plot.err_modes(da, G, kind='inc')[source]

Wrap energy release rate plot.

weac.plot.fea_disp(instance, x, z, fea)[source]

Wrap dispalcements plot.

weac.plot.fea_stress(instance, xb, zb, fea)[source]

Wrap stress plot.

weac.plot.outline(grid)[source]

Extract outline values of a 2D array (matrix, grid).

weac.plot.plot_data(name, ax1data, ax1label, ax2data=None, ax2label=None, labelpos=None, vlines=True, li=False, mi=False, ki=False, xlabel='Horizontal position $x$ (cm)')[source]

Plot data. Base function.

weac.plot.save_plot(name)[source]

Show or save plot depending on interpreter

Parameters:

name (string) – Name for the figure.

weac.plot.section_forces(instance, x, z, i='', **segments)[source]

Wrap section forces plot.

weac.plot.set_plotstyles()[source]

Define styles plot markers, labels and colors.

weac.plot.significant_digits(decimal)[source]

Get the number of significant digits.

Parameters:

decimal (float) – Decimal number.

Returns:

Number of significant digits.

Return type:

int

weac.plot.slab_profile(instance)[source]

Create bar chart of slab profile.

weac.plot.stress_criteria(x, stress, **segments)[source]

Wrap plot of stress and energy criteria.

weac.plot.stresses(instance, x, z, i='', **segments)[source]

Wrap stress plot.

weac.plot.tight_central_distribution(limit, samples=100, tightness=1.5)[source]

Provide values within a given interval distributed tightly around 0.

Parameters:
  • limit (float) – Maximum and minimum of value range.

  • samples (int, optional) – Number of values. Default is 100.

  • tightness (int, optional) – Degree of value densification at center. 1.0 corresponds to equal spacing. Default is 1.5.

Returns:

Array of values more tightly spaced around 0.

Return type:

ndarray