siconos.io.mechanics_run module¶
Run a pre-configured Siconos “mechanics” HDF5 file.
- class siconos.io.mechanics_run.RunnerConfig(backend='bullet')[source]¶
Bases:
objectA 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
- 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:
MechanicsHdf5a 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
- 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]¶
- 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.
- import_births(body_class=None, shape_class=None, face_class=None, edge_class=None)[source]¶
Import new objects into the NSDS.
- output_dynamic_objects(initial=False)[source]¶
Outputs translations and orientations of dynamic objects.
- output_contact_forces()[source]¶
Outputs contact forces _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.
- 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.