Displacement and contact loss

This example illustrates the loss of contact when two bars in contact do not have the same impedance.

import numpy as np
import matplotlib.pyplot as plt
from elwaspatid import Waveprop, WP2, BarSingle, BarSet
plt.close('all')

E = 210e9  # [MPa]
rho = 7800  # [kg/m3]
L = 1  # [m]
d = 0.02  # [m]

incw = np.zeros(80)  # incident wave
incw[0:20] = 1  # /!\ traction pulse

Small impedance against large impedance

The impacting bar stays in contact with the right bar during one back-and-forth travel of the compression wave in it. Then contact ceases and the left bar strarts travelling to the left. A Heaviside compression pulse travels down the right bar.

L = 1  # [m]
bar = BarSet([E, E], [rho, rho], [L, 0.5*L], [d, 2*d], nmin=6)
testk = WP2(bar, left='free', right='infinite', Vinit=5)
testk.plot()
testk.plotInterface(0, 'interface')
  • Force [N]
  • Velocity [m/s]
  • Displacement [m]
  • x = 0 m

Out:

Simulation time set to 2 travels across all bars.
Setting initial velocity of first segment (Vo=5)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:395: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  ax1 = plt.subplot(nsbp, 1, 1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:402: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 2, sharex=ax1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:409: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 3, sharex=ax1)

Large impedance against small impedance

In that case, the impacting bar stays in contact indefinitly with the right bar and a “stair” compression pulse develops in the right bar, with steps of decreasing amplitude. See also Compare ElasticImpact and WP2

bar = BarSet([E, E], [rho, rho], [L, L], [d, 0.5*d], nmin=6)
testl = WP2(bar, nstep=150, left='free', right='infinite', Vinit=5)
testl.plot()

testl.plotInterface(0, 'interface2')
  • Force [N]
  • Velocity [m/s]
  • Displacement [m]
  • x = 0 m

Out:

Setting initial velocity of first segment (Vo=5)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:395: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  ax1 = plt.subplot(nsbp, 1, 1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:402: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 2, sharex=ax1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:409: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 3, sharex=ax1)

Contact loss detection

Did not find yet a combination of bar set and initial conditions (or incident wave) showing the usefulness of automatic contact loss detection.

This example however shows how to:

  • modify the section of a bar in a BarSet.

  • set contact loss detection;

Second bar with section increase

bar = BarSet([E, E], [rho, rho], [.2*L, L], [.8*d, d], nmin=12)
bar.changeSection(iseg=1, l=L/4, d=2*d)  # first section change on second bar
bar.changeSection(iseg=1, l=L/2, d=4*d)  # second section change on second bar
bar.plotProperties('Z')
plot 5 contactLoss

Out:

Markers and step positions are not precise yet...
Markers and step positions are not precise yet...

No contact loss

Check that no force cross the interface after separation of the two bars.

testm = WP2(bar, nstep=150, left='free', right='infinite', Vinit=5, contactLoss=None)
testm.plot()
testm.plotInterface(0, 'NoCL')
print(testm.contact)
  • Force [N]
  • Velocity [m/s]
  • Displacement [m]
  • x = 0 m

Out:

Setting initial velocity of first segment (Vo=5)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:395: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  ax1 = plt.subplot(nsbp, 1, 1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:402: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 2, sharex=ax1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:409: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 3, sharex=ax1)
{'state': [], 'threshold': None}

Contact loss

Again, check that no force cross the interface after separation of the two bars.

testc = WP2(bar, nstep=150, left='free', right='infinite', Vinit=5, contactLoss=1e-9)
testc.plot()
testc.plotInterface(0, 'CL')
print(testc.contact)
plt.show()
  • Force [N]
  • Velocity [m/s]
  • Displacement [m]
  • x = 0 m

Out:

Setting initial velocity of first segment (Vo=5)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:395: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  ax1 = plt.subplot(nsbp, 1, 1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:402: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 2, sharex=ax1)
/home/docs/checkouts/readthedocs.org/user_builds/elwaspatid/checkouts/latest/src/elwaspatid/elwaspatid.py:409: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.
  plt.subplot(nsbp, 1, 3, sharex=ax1)
{'state': [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'threshold': 1e-09}

Total running time of the script: ( 0 minutes 3.939 seconds)

Gallery generated by Sphinx-Gallery