예제 #1
0
    def __init__(self, n_elements, shear_matrix, bend_matrix, rod, *args, **kwargs):
        _LinearConstitutiveModelMixin.__init__(
            self,
            n_elements,
            shear_matrix,
            bend_matrix,
            rod.rest_lengths,
            *args,
            **kwargs
        )
        _CosseratRodBase.__init__(
            self,
            n_elements,
            rod._vector_states.copy()[..., : n_elements + 1],
            rod._matrix_states.copy(),
            rod.rest_lengths,
            rod.density,
            rod.volume,
            rod.mass_second_moment_of_inertia,
            rod.nu,
            *args,
            **kwargs
        )
        _RodSymplecticStepperMixin.__init__(self)
        del rod

        # This below two lines are for initializing sigma and kappa
        self._compute_shear_stretch_strains()
        self._compute_bending_twist_strains()
예제 #2
0
    def __init__(self, systems: Sequence):

        self.n_elems_in_rods = np.array([x.n_elems for x in systems],
                                        dtype=np.int64)
        self.n_rods = len(systems)
        (
            self.n_elems,
            self.ghost_nodes_idx,
            self.ghost_elems_idx,
            self.ghost_voronoi_idx,
        ) = make_block_memory_metadata(self.n_elems_in_rods)
        self.n_nodes = self.n_elems + 1
        self.n_voronoi = self.n_elems - 1

        # n_nodes_in_rods = self.n_elems_in_rods + 1
        # n_voronois_in_rods = self.n_elems_in_rods - 1

        self.start_idx_in_rod_nodes = np.hstack(
            (0, self.ghost_nodes_idx + 1))  # Start index of subsequent rod
        self.end_idx_in_rod_nodes = np.hstack(
            (self.ghost_nodes_idx, self.n_nodes
             ))  # End index of the rod, Some max size, doesn't really matter
        self.start_idx_in_rod_elems = np.hstack(
            (0, self.ghost_elems_idx[1::2] + 1))
        self.end_idx_in_rod_elems = np.hstack(
            (self.ghost_elems_idx[::2], self.n_elems))
        self.start_idx_in_rod_voronoi = np.hstack(
            (0, self.ghost_voronoi_idx[2::3] + 1))
        self.end_idx_in_rod_voronoi = np.hstack(
            (self.ghost_voronoi_idx[::3], self.n_voronoi))

        # Allocate block structure using system collection.
        self.allocate_block_variables_in_nodes(systems)
        self.allocate_block_variables_in_elements(systems)
        self.allocate_blocks_variables_in_voronoi(systems)
        self.allocate_blocks_variables_for_symplectic_stepper(systems)

        # Reset ghosts of mass, rest length and rest voronoi length to 1. Otherwise
        # since ghosts are not modified, this causes a division by zero error.
        _reset_scalar_ghost(self.mass, self.ghost_nodes_idx, 1.0)
        _reset_scalar_ghost(self.rest_lengths, self.ghost_elems_idx, 1.0)
        _reset_scalar_ghost(self.rest_voronoi_lengths, self.ghost_voronoi_idx,
                            1.0)

        # Initialize the mixin class for symplectic time-stepper.
        _RodSymplecticStepperMixin.__init__(self)
예제 #3
0
    def __init__(
        self,
        n_elements,
        _vector_states,
        _matrix_states,
        radius,
        mass_second_moment_of_inertia,
        inv_mass_second_moment_of_inertia,
        shear_matrix,
        bend_matrix,
        density,
        volume,
        mass,
        dissipation_constant_for_forces,
        dissipation_constant_for_torques,
        internal_forces,
        internal_torques,
        external_forces,
        external_torques,
        lengths,
        rest_lengths,
        tangents,
        dilatation,
        dilatation_rate,
        voronoi_dilatation,
        rest_voronoi_lengths,
        sigma,
        kappa,
        rest_sigma,
        rest_kappa,
        internal_stress,
        internal_couple,
        damping_forces,
        damping_torques,
    ):
        self.n_elems = n_elements
        self._vector_states = _vector_states
        self._matrix_states = _matrix_states
        self.radius = radius
        self.mass_second_moment_of_inertia = mass_second_moment_of_inertia
        self.inv_mass_second_moment_of_inertia = inv_mass_second_moment_of_inertia
        self.shear_matrix = shear_matrix
        self.bend_matrix = bend_matrix
        self.density = density
        self.volume = volume
        self.mass = mass
        self.dissipation_constant_for_forces = dissipation_constant_for_forces
        self.dissipation_constant_for_torques = dissipation_constant_for_torques
        self.internal_forces = internal_forces
        self.internal_torques = internal_torques
        self.external_forces = external_forces
        self.external_torques = external_torques
        self.lengths = lengths
        self.rest_lengths = rest_lengths
        self.tangents = tangents
        self.dilatation = dilatation
        self.dilatation_rate = dilatation_rate
        self.voronoi_dilatation = voronoi_dilatation
        self.rest_voronoi_lengths = rest_voronoi_lengths
        self.sigma = sigma
        self.kappa = kappa
        self.rest_sigma = rest_sigma
        self.rest_kappa = rest_kappa
        self.internal_stress = internal_stress
        self.internal_couple = internal_couple
        self.damping_forces = damping_forces
        self.damping_torques = damping_torques

        _RodSymplecticStepperMixin.__init__(self)
 def __init__(self, systems):
     MemoryBlockCosseratRod.__init__(self, systems)
     _RodSymplecticStepperMixin.__init__(self)