#============================================================* # test mass spring with spheres * #============================================================* system echo = off system verbose = false # set units #---------- units units scale name = mass uname = reducedMass value = 10000.0 # create two spheres #------------------- solid create name = sp1 type = sphere radius = 0.4 center = [ 0.0 0.0 0.0 ] solid create name = sp2 type = sphere radius = 0.4 center = [ 2.0 0.0 0.0 ] solid create name = sp3 type = sphere radius = 0.4 center = [ 4.0 0.0 0.0 ] # create bodies #-------------- body create name = ground type = ground body create name = sp1b type = static solid = sp1 body create name = sp2b type = rigid solid = sp2 body create name = sp3b type = static solid = sp3 body sp2b damping = 0.1 #----- ground joint -----# joint create name = groundJnt type = ball solid = sp1 joint groundJnt color = [ 1 1 1 ] msize = 0.08 shading = color show = true joint groundJnt bodies = { ground sp1b } joint create name = groundJnt1 type = ball solid = sp3 joint groundJnt1 color = [ 1 1 1 ] msize = 0.08 shading = color show = true joint groundJnt1 bodies = { ground sp3b } # create a rigid simulation #-------------------------- simulation create name = rsim type = rigid # set solver #----------- simulation rsim solver = ode # add bodies #----------- simulation rsim add bodies = all simulation rsim add joints = all # add potential #-------------- solid sp1 define region = sp1Rgn use_center = true solid sp2 define region = sp2Rgn use_center = true body sp1b add potential = sp1Pot type = spring region = sp1Rgn \ geometry = points color = [ 0 1 0 ] \ force_const = 1.0 cutoff = 2.8 show = true body sp2b add potential = sp2Pot type = spring region = sp2Rgn \ geometry = points color = [ 0 1 0 ] \ force_const = 1.0 cutoff = 2.8 show = true simulation rsim add interaction = sp1Sp2Pot \ body1 = sp1b potential1 = sp1Pot \ body2 = sp2b potential2 = sp2Pot \ time = { 0.0 1000.0 } # add forces #----------- force create name = force1 type = explicit point = [ 0 0 0 ] \ direction = [ 1 0 0 ] scale = 1.0 #simulation rsim add force = force1 body = sp2b time = { 0 1.0 } # add restraint #-------------- #solid sp2 define region = sp2Rgn use_center = true #solid sp3 define region = sp3Rgn use_center = true #simulation rsim add restraint = res1 \ body1 = sp2b region1 = sp2Rgn \ body2 = sp3b region2 = sp3Rgn \ ramp = 10 \ force_const = 40.0 distance = 0.99 \ time = { 0 10 } # initialize simulation #---------------------- simulation rsim initialize simulation rsim time step = 0.005 #simulation state save_frequency = 10 simulation rsim momentum = on #simulation rsim damping = on # write energy #------------- simulation rsim write energy = true file_name = rsim simulation rsim write kinetic_energy = true file_name = rsim_ke # print body masses #------------------ #body sp1b print properties = mass body sp2b print properties = mass