siconos.io.mechanics_run module

Run a pre-configured Siconos “mechanics” HDF5 file.

siconos.io.mechanics_run.rotate_point(x, y, alpha)[source]
class siconos.io.mechanics_run.RunnerConfig(backend='bullet')[source]

Bases: object

A class to manage the backend and the default classes to be used

This class allows you to configure the backend for the simulation. It supports three backends: - ‘bullet’ for Bullet Physics Engine - ‘occ’ for OpenCascade Geometry (occ) - ‘native’ for a native simulation - ‘vnative’ for a vectorized native simulation

setup_default_classes()[source]
set_backend(b)[source]
class siconos.io.mechanics_run.MechanicsHdf5Runner_run_options[source]

Bases: dict

display()[source]
check_valid_run_options()[source]
class siconos.io.mechanics_run.MechanicsHdf5Runner(config=None, io_filename=None, io_filename_backup=None, mode='w', interaction_manager=None, nsds=None, simulation=None, osi=None, shape_filename=None, set_external_forces=None, gravity_scale=None, collision_margin=None, use_compression=False, output_domains=False, verbose=True)[source]

Bases: MechanicsHdf5

a Hdf5 context manager that reads the translations and orientations of collision objects from hdf5 file

It provides functions to output translations and orientations in the same file during simulation (output is done by default in pos.dat)

Parameters:

io_filename (string, optional) –

hdf5 file name, default = <caller>.hdf5, caller being the name

without ext of the file that instanciates the Runner.

mode: string, optional

h5 mode (w, r, append), default = ‘w’

interaction_manager: SiconosCollisionManager, optional

user-defined interaction handler (e.g. from Bullet), default=None

nsds: siconos::modeling::NonSmoothDynamicalSystem, optional

default = None

simulation: Simulation, optional

default = None

osi: OneStepIntegrator, optional

default = None

shape_filename: string

vtk file describing a mesh, default = None

set_external_forces: python function, optional

function used to apply forces onto the body. Must be :

def funcname(body)

body being a siconos Body (DS) Default : apply gravity forces.

gravity_scale: real, optional

multiplication factor for the gravity. 1. for meters (default). 1./100 for centimeters. This parameter may be needed for small objects because of Bullet collision margin.

collision_margin: real number, optional

tolerance for collision, default = None (0.04 in Shape builder)

use_compression: boolean, optional

true to use compression for h5 file, default=False

output_domains: boolean, optional

if trueoutputs info regarding contact point domains default=False

verbose: boolean, optional

default=True

log(fun, with_timer=False, after=True, already_done=False)[source]
apply_gravity(body)[source]
import_nonsmooth_law(name)[source]
import_native_object(name, translation, orientation, velocity, contactors, material, boundary_conditions, nodal_forces, mass, given_inertia, body_class, shape_class, birth=False, number=None)[source]
import_occ_object(name, translation, orientation, velocity, contactors, mass, given_inertia, body_class, shape_class, face_class, edge_class, birth=False, number=None)[source]
import_bullet_object(name, translation, orientation, velocity, contactors, mass, inertia, body_class, shape_class, birth=False, number=None)[source]
make_coupler_jointr(ds1_name, ds2_name, coupled, references)[source]
import_joint(name)[source]
import_boundary_conditions(name)[source]
import_permanent_interactions(name)[source]
import_object(name, body_class=None, shape_class=None, face_class=None, edge_class=None, birth=False, translation=None, orientation=None, velocity=None)[source]

Import an object by name, possibly overriding initial position and velocity.

import_objects(name, body_class=None, shape_class=None, face_class=None, edge_class=None, birth=False)[source]

Import several objects at once.

import_scene(time, body_class, shape_class, face_class, edge_class)[source]

From the specification given in the hdf5 file with the help of add* functions, import into the NSDS:

  • the static objects

  • the dynamic objects

  • the joints

and into the interaction_manager:

  • the nonsmooth laws that have a specified time of birth <= current time.

current_time()[source]
import_births(body_class=None, shape_class=None, face_class=None, edge_class=None)[source]

Import new objects into the NSDS.

execute_deaths()[source]

Remove objects from the NSDS

output_static_objects()[source]

Outputs translations and orientations of static objects

output_radii()[source]

Outputs radii.

output_p0s()[source]

Outputs p0 vectors

output_displacements()[source]
output_dynamic_objects(initial=False)[source]

Outputs translations and orientations of dynamic objects.

output_velocities()[source]

Output velocities of dynamic objects

output_contact_forces()[source]

Outputs contact forces _output_contact_index_set default value is 1.

output_contact_info()[source]

Outputs contact infos _output_contact_index_set default value is 1.

output_contact_work()[source]

Outputs contact contact_work _output_contact_index_set default value is 1.

output_energy_and_work()[source]

Outputs energy_and_work _output_contact_index_set default value is 1.

output_domains()[source]

Outputs domains of contact points

output_solver_infos()[source]

Outputs solver #iterations & precision reached

output_results(with_timer=False)[source]
output_run_options()[source]

Outputs run_options

print_solver_infos()[source]

Outputs solver #iterations & precision reached

import_external_functions()[source]
computeOneStep_python(with_timer)[source]
build_run_options_from_old_arguments_in_kwargs(run_options=None, with_timer=False, time_stepping=None, interaction_manager=None, bullet_options=None, vnative_options=None, controller=None, gravity_scale=1.0, t0=0, T=10, h=0.0005, multipoints_iterations=None, theta=0.50001, gamma=0.0, Newton_options=<TimeSteppingType.NONLINEAR: 2>, Newton_max_iter=20, set_external_forces=None, solver_options=None, solver_options_pos=None, osnspb_max_size=0, exit_tolerance=None, projection_itermax=20, projection_tolerance=1e-08, projection_tolerance_unilateral=1e-08, numerics_verbose=False, numerics_verbose_level=0, violation_verbose=False, verbose=True, verbose_progress=True, output_frequency=None, output_backup=False, output_backup_frequency=None, output_contact_forces=True, output_contact_info=True, output_contact_work=True, output_energy_work=False, friction_contact_trace_params=None, output_contact_index_set=1, osi=<class 'siconos.integrators.MoreauJeanOSI'>, constraint_activation_threshold=0.0, explode_Newton_solve=False, explode_computeOneStep=False, explode_computeOneStep_in_python=False, explode_computeOneStepNSProblem_in_python=False, display_Newton_convergence=False, start_run_iteration_hook=None, end_run_iteration_hook=None, before_next_step_iteration_hook=None, skip_last_update_output=False)[source]

Run a simulation from a set of parameters described in a hdf5 file.

run_initialize()[source]
solver_verbose(number_of_contacts)[source]
contact_statistics_verbose()[source]
run_loop()[source]
output_timer_at_the_end()[source]
run(*args, **kwargs)[source]