Beispiel #1
0
        # not given, it is a static object only involved in contact
        # detection.
        io.add_object('ground', [Contactor('Ground')], translation=[0, -.5])

# Run the simulation from the inputs previously defined and add
# results to the hdf5 file. The visualisation of the output may be done
# with the vview command.

bullet_options = SiconosBulletOptions()
bullet_options.worldScale = 1.0
bullet_options.contactBreakingThreshold = 0.04
bullet_options.dimension = SICONOS_BULLET_2D
bullet_options.perturbationIterations = 0
bullet_options.minimumPointsPerturbationThreshold = 0

options = sk.solver_options_create(sn.SICONOS_FRICTION_2D_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 100000
options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-8

T = 2.0
if restart:
    T = 2.0
#T=1*0.001
hstep = 0.01
run_options = MechanicsHdf5Runner_run_options()
run_options['t0'] = 0
run_options['T'] = T
run_options['h'] = hstep

run_options['bullet_options'] = bullet_options
run_options['solver_options'] = options
                                            0)
        vel2 = self.joint1.projectVectorDoF(self.ds2.linearVelocity(True), bv,
                                            0)
        vel_diff = vel1 - vel2
        damping_force = vel_diff * 10.0

        # Calculate total forces for each body
        force1 += -(spring_force + damping_force) / 2
        force2 += +(spring_force + damping_force) / 2

        print('applying spring-damper forces', force1, force2)

        self.ds1.setFExtPtr(force1)
        self.ds2.setFExtPtr(force2)


options = sk.solver_options_create(sn.SICONOS_GENERIC_MECHANICAL_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 1000
options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-12

# Load and run the simulation
with MechanicsHdf5Runner(mode='r+') as io:
    io.run(t0=0,
           T=20,
           h=0.01,
           theta=0.5,
           Newton_max_iter=1,
           controller=Ctrl(),
           solver_options=options,
           output_frequency=1)
Beispiel #3
0
    # The cube object made with an unique Contactor : the cube shape.
    # As a mass is given, it is a dynamic system involved in contact
    # detection and in the simulation.  With no group id specified the
    # Contactor belongs to group 0
    io.add_object('sphere', [Contactor('Sphere')],
                  translation=[0, 0, 3],
                  velocity=[10, 0, 0, 0, 1, 0],
                  mass=1)

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved in contact
    # detection.
    io.add_object('ground', [Contactor('Ground')], translation=[0, 49, 0])

# Create solver options
options = sk.solver_options_create(sn.SICONOS_ROLLING_FRICTION_3D_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 100000
options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-8
test = True
if test:
    T = 1.0
    h = 5e-3
    options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 1000
    options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-4
else:
    T = 10.0
    h = 5e-3

# # Run the simulation from the inputs previously defined and add
# # results to the hdf5 file. The visualisation of the output may be done
# # with the vview command.
Moreau TimeStepping: h={0}, theta = {1}
One Step non smooth problem: {2}, maxiter={3}, tol={4}
""".format(hstep, theta, sn.solver_options_id_to_name(solver), itermax,
           tolerance)

mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=20,
    dump_probability=None,
    fileName=fileName,
    title=title,
    description=description,
    mathInfo=mathInfo)

options = sk.solver_options_create(solver)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = itermax
options.dparam[sn.SICONOS_DPARAM_TOL] = tolerance

# Load and run the simulation
with MechanicsHdf5Runner(mode='r+') as io:
    io.run(t0=0,
           T=step * hstep,
           h=hstep,
           theta=theta,
           Newton_max_iter=1,
           solver_options=options,
           output_frequency=1,
           osi=sk.MoreauJeanGOSI,
           friction_contact_trace_params=friction_contact_trace_params)
        io.add_object('brick{0}'.format(k + n * H), [Contactor('Brick')],
                      translation=[
                          n * bx - L * bx / 2. + (k % 2) * bx / 2., -5,
                          k * bz + bz / 2.
                      ],
                      mass=2)

    # the ground object made with the ground shape. As the mass is
    # not given, it is a static object only involved in contact
    # detection.
    io.add_object('ground', [Contactor('Ground')], translation=[0, 0, -.25])

# Run the simulation from the inputs previously defined and add
# results to the hdf5 file. The visualisation of the output may be done
# with the vview command.
options = sk.solver_options_create(sn.SICONOS_GENERIC_MECHANICAL_NSGS)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 10000
options.dparam[sn.SICONOS_DPARAM_TOL] = 1e-8
sk.solver_options_update_internal(options, 1,
                                  sn.SICONOS_FRICTION_3D_ONECONTACT_NSN)
#options=None

options_pos = sk.solver_options_create(sn.SICONOS_MLCP_ENUM)
options_pos.iparam[sn.SICONOS_IPARAM_MAX_ITER] = 10000
options_pos.dparam[sn.SICONOS_DPARAM_TOL] = 1e-12

test = True
h = 0.01
if test:
    T = 3 * h
else:
Beispiel #6
0
                             n_col=n_col,
                             x_shift=2.0,
                             roca_size=0.1,
                             top=3,
                             rate=0.02,
                             density=density)

    io.add_Newton_impact_friction_nsl('contact', mu=1.0, e=0.01)

dump_probability = .02
theta = 1.0
tolerance = 1e-03
if not os.path.exists('Chute'):
    os.mkdir('Chute')

options = sk.solver_options_create(sn.SICONOS_GLOBAL_FRICTION_3D_ADMM)
options.iparam[sn.SICONOS_IPARAM_MAX_ITER] = itermax
options.dparam[sn.SICONOS_DPARAM_TOL] = tolerance
fileName = "./Chute/Chute"
title = "Chute"
description = """
Chute with 6400 polyhedra with Bullet collision detection
Moreau TimeStepping: h={0}, theta = {1}
One Step non smooth problem: {2}, maxiter={3}, tol={4}
""".format(hstep, theta, sk.solver_options_id_to_name(options.solverId),
           itermax, tolerance)
mathInfo = ""

friction_contact_trace_params = FrictionContactTraceParams(
    dump_itermax=9000,
    dump_probability=None,