API reference

This module is based on the following paper:

Bacon, C. (1993). Numerical prediction of the propagation of elastic waves in longitudinally impacted rods : Applications to Hopkinson testing. International Journal of Impact Engineering, 13(4), 527‑539. https://doi.org/10.1016/0734-743X(93)90084-K

Summary– Simple expressions, based on one-dimensional elastic wave theory, are established which permit prediction of normal force and particle velocity at cross-sections of a non-uniform linearly-elastic rod. The initial normal force and particle velocity at each cross-section of that rod must be known. […]

First define a bar, then give it to WP2 or Waveprop along with an incident wave for propagation computation:

bar = BarSet(E=[210, 78], rho=[7800, 2800], L=[1, 1.1], d=[0.030, 0.028])
incw = np.ones(100)
prop = WP2(bar, incw)

Be careful:

  • WP2 works only with BarSet bars; traction is not transmitted throught interfaces

  • Waveprop works with BarSet and BarSingle bars, but does not take interfaces between bars/segments into account (the bars are stuck, traction can cross interfaces)

Created on Fri Aug 22 11:13:37 2014

@author: dbrizard

class elwaspatid.Bar(E, rho, L, d)

Description d’une barre continue par morceaux, avant discrétisation.

Internally used in BarSingle and BarSet

__init__(E, rho, L, d)

Compute area A, celerity c_o and impedance Z of bar segments.

All imput variables should have the same length and should be lists.

Parameters
  • E (list) – Young’s moduli

  • rho (list) – densities

  • L (list) – lengthes of the corresponding segments/bars

  • d (list) – diameters

__weakref__

list of weak references to the object (if defined)

plot()

Subplot of continuous variables across the bar length:

  • diameter d;

  • area A;

  • density rho;

  • modulus E;

  • celerity c_o;

  • impedance Z.

printtable()

Text representation of the bar through a table

class elwaspatid.BarSet(E, rho, L, d, dt=0, nmin=4, right='free')

Heterogeneous bar with cross-section/modulus/density changes along the bar length.

Sister class of BarSingle

seg is a list of Segment objects, this is then used in WP2.

Waveprop uses the other attributes.

__init__(E, rho, L, d, dt=0, nmin=4, right='free')

Define and spatially discretize bar into Segment s of constant properties

Parameters
  • E (list) – Young’s moduli

  • rho (list) – densities

  • L (list) – bar segment lengthes

  • d (list) – bar segment diameters

  • dt (float) – time step (automatically determined if 0)

  • nmin (int) – minimum number of ‘elements’ in a bar segment of constant properties

__repr__()

Instance representation method

changeSection(iseg=0, l=None, d=None)

Change the section of part of a Segment to model a bar with section change.

Parameters
  • iseg (int) – index of segment

  • l (float) – position of the section change

  • d (float) – new section for the right portion

plotProperties(figname=None)

Plot evolution of properties of the bar along the length

Parameters

figname (str) – name for the figure

class elwaspatid.BarSingle(dx, d, E, rho)

Homogeneous bar (ie continuous rod) with section changes.

Mother class of BarSet

__init__(dx, d, E, rho)

Barre homogème, avec uniquement des variations se section (d)

Zero impedance should be avoided for calculation step coming next within Waveprop.

Parameters
  • dx (flaot) – spatial discretization

  • d (list) – diameters

  • E (float) – Young’s modulus

  • rho (float) – density

__weakref__

list of weak references to the object (if defined)

plot(typ='DZ', ls='.-')

Graphical representation of discretized bar: geometry and impedance.

Parameters

typ (str) – choose graphical output (‘D’:diameter, ‘Z’:impedance)

class elwaspatid.ElasticImpact(E=210000000000.0, rho=7800, d=0.03, L=1.0, V=5.0)

Bussac, M.-N., P. Collet, G. Gary, B. Lundberg, and S. Mousavi. 2008. ‘Viscoelastic Impact between a Cylindrical Striker and a Long Cylindrical Bar’. International Journal of Impact Engineering 35 (4): 226–39. https://doi.org/10.1016/j.ijimpeng.2007.02.003.

__init__(E=210000000000.0, rho=7800, d=0.03, L=1.0, V=5.0)

Striker and bar of the same material. Only cross-section can change

Parameters
  • E (float) – Young’s modulus [Pa]

  • rho (float) – density [kg/m3]

  • d (list) – striker and bar diamter (can be a single float) [m]

  • L (float) – length of the striker [m]

  • V (flat) – impact velocity [m/s]

__weakref__

list of weak references to the object (if defined)

computeImpact(t, n=16, y0=0.5, plot=True)

Compute impact of stricker on bar.

Parameters
  • t (array) – time array

  • n (int) – number of terms in the summation

  • y0 (float) – value of Heaviside function when t=0

plotForce(figname=None, label=None)
Parameters

figname (str) – name for the figure

plotRn(figname=None)

Plot amplitude of successive steps in case striker impendace is greater than bar impedance

Parameters

figname (str) – name for the figure

class elwaspatid.Segment(nel, z, E, l, dx, dt, xo, left='infinite', right='infinite')

Bar segment with constant properties

For later use in WP2 through BarSet

__init__(nel, z, E, l, dx, dt, xo, left='infinite', right='infinite')
Parameters
  • nel (int) – number of elements in segment

  • z (float) – segment impedance

  • E (float) – segment elastic modulus

  • l (float) – segment length

  • dx (float) – length of elements in segment

  • dt (float) – time step

  • xo (float) – abscissa of left end of segment

  • left (str) – ‘infinite’, ‘free’, ‘impact’ or ‘interf’

  • right (str) – idem

The following attributes are added:

Variables
  • nX (int) – number of points along x direction

  • xplot (array) – x position of points in global coordinate system

__repr__()

Instance representation method

__weakref__

list of weak references to the object (if defined)

compDispl(it)

Compute displacement of the bar nodes at given time index.

Parameters

it (int) – time index

compLeft(it, lseg=None, incw=None, left=None)

Compute state of left bar end.

Bar end can be: free, infinite, interf (interface with another Segment), impact (impacted end, in which case incw must be given).

Parameters
  • it (int) – time index

  • lseg (obj) – left Segment

  • incw (float) – input force (incident wave)

  • left (str) – left boundary condition (supersedes Segment.left)

compMiddle(it)

Compute state in the middle of the segment

Parameters

it (int) – time index

compRight(it, rseg=None, right=None)

Compute state of right bar end.

Bar end can be: free, infinite, interf (interface with another Segment).

Parameters
  • it (int) – time index

  • rseg (obj) – right Segment

  • right (str) – right boundary condition (supersedes Segment.right)

computeStressStrain()

Compute Strain from Displacement and then Stress, in the elements

initCalc(nT, Vo=0)

Initialize before wave propagation computation

Parameters
  • nT (int) – number of computation/time steps

  • Vo (float) – initial velocity

plot(typ='VF', vert=None, autovert=True)

Plot lagrange diagram.

Wrapper for Segment.plotmatrix() allowing to choose the plotted data.

Parameters
  • typ (str) – choose the diagram to plot (‘V’: Velocity, ‘F’:Force)

  • vert (list) – vertical lines to add

  • autovert (bool) – automatically plot vertical lines at bar ends

plotProperties(figname=None, label=None)
Parameters
  • figname (str) – name for the figure

  • color (str) – filling color of elements

plotmatrix(Zvalues, title=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, vert=None, autovert=True)

Plot lagrange diagram of matrix Zvalues.

Mainly used in Segment.plot() or directly for development.

resetImpedance(l, z)

Reset impedance of elements after position l along the length

Be careful, this new impedance MUST NOT change wave speed. Otherwise spatial discretization is obsolete. Only section change is permitted.

Parameters
  • l (float) – beginning position of new impedance

  • z (float) – new impedance

setTime(time)

Set time attribute.

Parameters

time (array) – time vector

class elwaspatid.WP2(bar, incw=None, nstep=0, left='free', right='free', Vinit=0, contactLoss=1e-09)

Second version of wave propagation, using Segment for each bar of constant section.

Traction cannot cross the contact interface between bars.

__init__(bar, incw=None, nstep=0, left='free', right='free', Vinit=0, contactLoss=1e-09)

Computte wave propagation

/!Anechoic condition at impact end (left) until the end of the prescribed incident wave incw

Parameters
  • bar (obj) – bar setup (BarSet object)

  • incw (array) – incident force wave (input left impact)

  • nstep (int) – optional number of time step

  • left (str) – left boundary condition, once incident wave is finished

  • right (str) – right boundary condition (‘free’ or ‘infinite’)

  • Vinit (float) – initial velocity of left bar

  • contactLoss (float) – threshold for contact loss between segments. No loss if None

__weakref__

list of weak references to the object (if defined)

gatherForce()

Gather all the Force of each Segment in BarSet in one array.

getSignal(x, iseg=None, plot=True, Displ=True, time='ms', figname=None, marker=None)

Get temporal signal at given position on the bar.

Parameters
  • x (float) – x position of sensor (local coordinates if iseg is given, otherwise global)

  • iseg (int) – index of segment where the sensor is

  • plot (bool) – enable graphical output or not

  • Displ (bool) – also return (and plot) displacement

  • time (str) – time scale (‘s’, ‘ms’, ‘µs’)

  • figname (str) – name for the figure

  • marker (str) – marker

Variables
  • F (array) – Force

  • V (array) – Velocity

  • xx (array) –

    ??

  • indx (array) –

    ??

getState(t, plot=True)

Get state of the bars at given time.

Parameters
  • t (float) – time at which state is desired

  • plot (bool) – enable graphical output or not

plot(figname=None, gatherForce=True, typ='FVD')

Plot Force and Velocity lagrangian diagrams (time versus space)

Wrapper of WP2.subplot() method

Parameters
  • figname (str) – name for the figure

  • gatherForce (bool) – do not use subplot for Force diagram

  • typ (str) – choose variables to plot (F: force, V: velocity, D: displacement)

plotDeSaintVenant(scale=100, figname=None, ms=5, lines='0.8')

Plot x-t displacement diagram.

Parameters
  • scale (float) – scale factor to increase Displ and make it visible

  • figname (str) – name for the figure

  • ms (float) – give marker size to get points plotted (color=Force)

  • lines (color) – give color to get lines plotted

plotForce(figname=None, vert=None, autovert=True)

Plot Force lagrangian diagram (time versus space)

Parameters
  • figname (str) – name for the figure

  • vert (list) – vertical lines to trace

  • autovert (bool) – automatically plot vertical lines at interfaces and bar ends

plotInterface(interf=0, figname=None, markers='.+')

Plot Force, Velocity and Displacement at interface between Segments

Basically a wrapper of WP2.getSignal() which takes care of selecting the right indices to get data at the given interface.

Parameters
  • interf (int) – interface index

  • figname (str) – name for the figure

  • markers (str) – markers for left and right variables

subplot(figname=None, typ='Veloc')

Plot Force or Velocity lagrangian diagram (time versus space) on a subplot for each segment

Parameters

ForV (str) – Force or Velocity (‘F’, ‘V’)

class elwaspatid.Waveprop(bar, incw, nstep=0, left='free', right='free', Vinit=0, indV=None)

One-dimensional wave propagation problem for a rod with a piecewise constant impedance.

/!Impedance should not be null.

Right side of the bar is a free end Left side of the bar is infinite bar (anechoic conditions)

__init__(bar, incw, nstep=0, left='free', right='free', Vinit=0, indV=None)

Compute propagation of incident wave in the given bar.

First version: traction can cross section changes (ie interfaces)

Parameters
  • bar (obj) – instance of BarSingle or BarSet

  • incw (array) – incident wave

  • nstep (int) – number of calculation steps (if 0, length of incw)

  • left (str) – left boundary condition (‘free’, ‘fixed’ or ‘infinite’) after the end of incw

  • right (str) – right boundary condition (‘free’, ‘fixed’ or ‘infinite’)

  • Vinit (float) – initial bar velocity

  • indV (int) – index of end of impact section! LEFT=impactor=speed, RIGHT=bars=static

__weakref__

list of weak references to the object (if defined)

compState(seuil, plot=True)

Compute again state (left or right propagating waves) based on given seuil

The threshold above which the wave is taken into account is computed as LR.ptp()*seuil

seuil means that this method was used.

Mainly for development purpose…

Parameters
  • seuil (float) – threshold

  • plot (bool) – enable graphical output

getcut(x=None, t=None, isind=False)

Get temporal evolution at given abscissa x, or state of the bar at given time t.

Parameters
  • x (float) – get temporal evolution at abscissa x.

  • t (float) – get bar state at given time t.

  • isind (bool) – boolean to specify index instead of abscissa/time value.

Returns

time (for given x) or abscissa (for given t)

Returns

force

Returns

particule velocity

plot(typ='VF', vert=None, autovert=True)

Plot lagrange diagram -time versus space- of wave propagation.

Type of diagram can be:

  • ‘V’: Velocity;

  • ‘F’: Force;

  • ‘dir’: wave direction (left or right);

  • ‘state’: wave direction (Left (+1) or Right (-1));

  • ‘sig’: stress (sigma);

  • ‘eps’: strain (epsilon).

Parameters
  • typ (str) – the diagram(s) to plot

  • vert (list) – list of vertical lines to plot on the diagram.

  • autovert (bool) – automatically plot vertical lines corresponding to bar lengthes.

plotDeSaintVenant(scale=100, figname=None, ms=5, lines='0.8', XPplot=False)

Plot x-t displacement diagram.

Parameters
  • scale (float) – scale factor to increase Displ and make it visible

  • figname (str) – name for the figure

  • ms (float) – give marker size to get points plotted (color=Force)

  • lines (color) – give color to get lines plotted

  • XPplot (bool) – experimental plots with pcolor. Warning: grid is not correctly adjusted yet.

plotEvol(indf=None)

Plot evolution of state of the bar as time increases

Parameters

indf (int) – final index until which to plot data

plotFV(x, figname=None)

Plot wave in Force-Velocity plane.

Parameters

x (float) – get temporal evolution at abscissa x.

plotcut(x=None, t=None, isind=False, tscale='ms')

Plot temporal evolution at given abscissa x, or state of the bar at given time t.

/!one of x or t arguments MUST be None.

Parameters
  • x (float) – get temporal evolution at abscissa x.

  • t (float) – get bar state at given time t.

  • isind (bool) – give time/abscissa index instead of time/abscissa value

See also Waveprop.getcut()

plotmatrix(Zvalues, title=None, cmap='PRGn', vert=None, autovert=True, time='ms')

Plot lagrange diagram of matrix Zvalues.

Mainly used in plot() or directly for development.

Parameters
  • Zvalues (array) –

  • title (str) – title for the figure

  • cmap (cmap) – colormap

  • vert (list) – list of position of vertical lines to plot (or None)

  • autovert (bool) – automatic vertical lines at segment changes

  • time (str) – time scale (‘ms’, ‘s’, ‘µs’)

elwaspatid.getMax(mat)

Get the maximum absolute extremum.

Parameters

mat (array) – 2D array

elwaspatid.getMinMaxQMCoordinates(QM)

Get min and max for x and y coordinates

Parameters

QM (QuadMesh) – matplotlib.collections.QuadMesh object from plt.pcolormesh()

elwaspatid.groovedBar(interv, lg=0.003, LL=2, d0=0.03, d1=0.0278, E=78000000000.0, rho=2800, pin=False)

Construct BarSet object with grooves

Parameters
  • interv (list) – interval length seperating each groove

  • lg (float) – lenght of groove along bar axis

  • LL (float) – total length of grooved stricker + impacted bar

  • d0 (float) – initial diameter of bar

  • d1 (float) – groove diameter

  • E (float) – Young’s modulus

  • rho (float) – density

elwaspatid.scaleTime(time, scale='s')

Return scaled time or index

Parameters
  • time (array) – input time array, unit supposed to be in [s]

  • scale (str) – desired output unit (‘s’, ‘ms’, ‘µs’). Can also be ‘ind’

elwaspatid.trapezeWave(plateau=20, rise=5, fall=None, A=1)

Define trapezoidal incident wave

Parameters
  • plateau (int) – number of points on the plateau

  • rise (int) – number of points for rising part

  • fall (int) – number of points for falling part

  • A (float) – amplitude of wave