Example #1
0
orig.radius[:] = 1.0
orig.x[0,:] = [5.0, 5.0, 1.05]
orig.vel[0,2] = -0.1
orig.defineWorldBoundaries(L=[10,10,10])
orig.gamma_wn[0] = 1.0e6
orig.gamma_wt[0] = 0.0
orig.initTemporal(total = 1.0, file_dt = 0.01)
Ekin_before = orig.energy('kin')
orig.run(verbose=False)
#orig.writeVTKall()
orig.readlast(verbose=False)
Ekin_after = orig.energy('kin')
Ev_after = orig.energy('visc_n')
#print("Ekin_before = " + str(Ekin_before) + " J")
#print("Ekin_after  = " + str(Ekin_after) + " J")
pytestutils.test(Ekin_before > Ekin_after,
        "Viscoelastic normal wall collision (1/2):")
pytestutils.compareFloats(Ekin_before, Ekin_after+Ev_after,\
        "Viscoelastic normal wall collision (2/2):", tolerance=0.05)

# Oblique impact: Check for conservation of momentum (sum(v_i*m_i))
orig = sphere.sim(np=1, sid='contactmodeltest')
orig.radius[:] = 1.0
orig.x[0,:] = [5.0, 5.0, 1.05]
orig.vel[0,2] = -0.1
orig.vel[0,0] =  0.1
orig.defineWorldBoundaries(L=[10,10,10])
orig.gamma_wn[0] = 1.0e6
orig.gamma_wt[0] = 1.0e6
orig.initTemporal(total = 1.0, file_dt = 0.01)
E_kin_before = orig.energy('kin')
orig.run(verbose=False)
Example #2
0
orig.radius[:] = [1.0, 1.0]
orig.x[0,:] = [5.0, 5.0, 2.0]
orig.x[1,:] = [5.0, 5.0, 4.05]
orig.setYoungsModulus(7.0e9)
v_orig = 1
orig.vel[0,2] = v_orig
orig.defineWorldBoundaries(L=[10,10,10])
orig.initTemporal(total = 0.1, file_dt = 0.01)
orig.gamma_n[0] = 1.0e6

orig.run(verbose=False)
after.readlast(verbose=False)
#print(orig.totalKineticEnergy())
#print(after.totalKineticEnergy())
#print(after.totalViscousEnergy())
pytestutils.test(orig.vel[0,2] > after.vel[1,2],\
        "Viscoelastic normal collision (1/4):")
pytestutils.compareFloats(orig.totalKineticEnergy(),
                          after.totalKineticEnergy()
                          + after.totalViscousEnergy(),
        "Viscoelastic normal collision (2/4):", tolerance=0.05)

# Normal impact with different sizes: Check for conservation of momentum
orig = sphere.sim(np=2, sid='contactmodeltest')
after = sphere.sim(np=2, sid='contactmodeltest')
sphere.cleanup(orig)
orig.radius[:] = [2.0, 1.0]
orig.x[0,:] = [5.0, 5.0, 2.0]
orig.x[1,:] = [5.0, 5.0, 5.05]
orig.setYoungsModulus(7.0e9)
orig.vel[0,2] = 1.0
orig.defineWorldBoundaries(L=[10,10,10])
Example #3
0
orig.radius[:] = 1.0
orig.x[0, :] = [5.0, 5.0, 1.05]
orig.vel[0, 2] = -0.1
orig.defineWorldBoundaries(L=[10, 10, 10])
orig.gamma_wn[0] = 1.0e6
orig.gamma_wt[0] = 0.0
orig.initTemporal(total=1.0, file_dt=0.01)
Ekin_before = orig.energy('kin')
orig.run(verbose=False)
#orig.writeVTKall()
orig.readlast(verbose=False)
Ekin_after = orig.energy('kin')
Ev_after = orig.energy('visc_n')
#print("Ekin_before = " + str(Ekin_before) + " J")
#print("Ekin_after  = " + str(Ekin_after) + " J")
pytestutils.test(Ekin_before > Ekin_after,
                 "Viscoelastic normal wall collision (1/2):")
pytestutils.compareFloats(Ekin_before, Ekin_after+Ev_after,\
        "Viscoelastic normal wall collision (2/2):", tolerance=0.05)

# Oblique impact: Check for conservation of momentum (sum(v_i*m_i))
orig = sphere.sim(np=1, sid='contactmodeltest')
orig.radius[:] = 1.0
orig.x[0, :] = [5.0, 5.0, 1.05]
orig.vel[0, 2] = -0.1
orig.vel[0, 0] = 0.1
orig.defineWorldBoundaries(L=[10, 10, 10])
orig.gamma_wn[0] = 1.0e6
orig.gamma_wt[0] = 1.0e6
orig.initTemporal(total=1.0, file_dt=0.01)
E_kin_before = orig.energy('kin')
orig.run(verbose=False)