Exemplo n.º 1
0
# Normal impact: Check for conservation of momentum (sum(v_i*m_i))
orig = sphere.sim(np=1, nw=0, sid='contactmodeltest')
sphere.cleanup(orig)
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] = 0.0  # Disable wall viscosity
orig.gamma_wt[0] = 0.0  # Disable wall viscosity
orig.initTemporal(total = 1.0, file_dt = 0.01)
#orig.time_dt = orig.time_dt*0.1
moment_before = orig.totalKineticEnergy()
orig.run(verbose=False)
#orig.writeVTKall()
orig.readlast(verbose=False)
pytestutils.compareFloats(orig.vel[0,2], 0.1,\
        "Elastic normal wall collision (1/2):")
moment_after = orig.totalKineticEnergy()
#print(moment_before)
#print(moment_after)
#print("time step: " + str(orig.time_dt[0]))
#print(str((moment_after[0]-moment_before[0])/moment_before[0]*100.0) + " %")
pytestutils.compareFloats(moment_before, moment_after,\
        "Elastic normal wall collision (2/2):")

# 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])
Exemplo n.º 2
0
after = sphere.sim(np=2, sid='contactmodeltest')
sphere.cleanup(orig)
#orig.radius[:] = [1.0, 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.run(dry=True)
orig.run(verbose=False)
after.readlast(verbose=False)
pytestutils.compareFloats(orig.vel[0,2], after.vel[1,2],\
        "Elastic normal collision (1/4):")
#print(orig.totalKineticEnergy())
#print(after.totalKineticEnergy())
pytestutils.compareFloats(orig.totalKineticEnergy(), after.totalKineticEnergy(),\
        "Elastic normal collision (2/4):")

# 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])
Exemplo n.º 3
0
# Normal impact: Check for conservation of momentum (sum(v_i*m_i))
orig = sphere.sim(np=1, nw=0, sid='contactmodeltest')
sphere.cleanup(orig)
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] = 0.0  # Disable wall viscosity
orig.gamma_wt[0] = 0.0  # Disable wall viscosity
orig.initTemporal(total=1.0, file_dt=0.01)
#orig.time_dt = orig.time_dt*0.1
moment_before = orig.totalKineticEnergy()
orig.run(verbose=False)
#orig.writeVTKall()
orig.readlast(verbose=False)
pytestutils.compareFloats(orig.vel[0,2], 0.1,\
        "Elastic normal wall collision (1/2):")
moment_after = orig.totalKineticEnergy()
#print(moment_before)
#print(moment_after)
#print("time step: " + str(orig.time_dt[0]))
#print(str((moment_after[0]-moment_before[0])/moment_before[0]*100.0) + " %")
pytestutils.compareFloats(moment_before, moment_after,\
        "Elastic normal wall collision (2/2):")

# 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])