Skip to content

Commit

Permalink
Merge pull request #172 from bhosale2/171_update_internal_damping_rod…
Browse files Browse the repository at this point in the history
…_rigid_body

update: Damping values for rod-rigid body contact cases (#171)
  • Loading branch information
armantekinalp authored Aug 10, 2022
2 parents c0b0b27 + 4974ba1 commit 67c3b9e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

def rod_cylinder_contact_case(inclination_angle=0.0):
class RodCylinderParallelContact(
BaseSystemCollection, Constraints, Connections, CallBacks, Forcing
BaseSystemCollection, Constraints, Connections, CallBacks, Forcing, Damping
):
pass

rod_cylinder_parallel_contact_simulator = RodCylinderParallelContact()

# time step etc
final_time = 10.0
time_step = 1e-4
time_step = 5e-4
total_steps = int(final_time / time_step) + 1
rendering_fps = 30 # 20 * 1e1
step_skip = int(1.0 / (rendering_fps * time_step))
Expand All @@ -25,7 +25,6 @@ class RodCylinderParallelContact(
poisson_ratio = 0.5
shear_modulus = E / (2 * (1 + poisson_ratio))
n_elem = 50
nu = 0.5
start = np.zeros((3,))
direction = np.array([np.sin(inclination_angle), 0.0, np.cos(inclination_angle)])
normal = np.array([0.0, 1.0, 0.0])
Expand All @@ -38,7 +37,7 @@ class RodCylinderParallelContact(
base_length,
base_radius,
density,
nu,
0.0, # internal damping constant, deprecated in v0.3.0
E,
shear_modulus=shear_modulus,
)
Expand Down Expand Up @@ -70,6 +69,14 @@ class RodCylinderParallelContact(
nu=0.1,
)

# add damping
damping_constant = 1e-2
rod_cylinder_parallel_contact_simulator.dampen(rod).using(
AnalyticalLinearDamper,
damping_constant=damping_constant,
time_step=time_step,
)

# Add callbacks
post_processing_dict_list = []
# For rod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ def rod_cylinder_contact_friction_case(
force_coefficient=0.1, normal_force_mag=10, POST_PROCESSING=False
):
class RodCylinderParallelContact(
BaseSystemCollection, Constraints, Connections, CallBacks, Forcing
BaseSystemCollection, Constraints, Connections, CallBacks, Forcing, Damping
):
pass

rod_cylinder_parallel_contact_simulator = RodCylinderParallelContact()

# time step etc
final_time = 20.0
time_step = 1e-4
final_time = 10.0
time_step = 5e-4
total_steps = int(final_time / time_step) + 1
rendering_fps = 30 # 20 * 1e1
step_skip = int(1.0 / (rendering_fps * time_step))
Expand All @@ -27,7 +27,6 @@ class RodCylinderParallelContact(
poisson_ratio = 0.5
shear_modulus = E / (2 * (1 + poisson_ratio))
n_elem = 50
nu = 0.5
start = np.zeros((3,))
direction = np.array([0, 0.0, 1.0])
normal = np.array([0.0, 1.0, 0.0])
Expand All @@ -40,7 +39,7 @@ class RodCylinderParallelContact(
base_length,
base_radius,
density,
nu,
0.0, # internal damping constant, deprecated in v0.3.0
E,
shear_modulus=shear_modulus,
)
Expand All @@ -57,6 +56,14 @@ class RodCylinderParallelContact(
UniformForces, force=normal_force_mag * force_coefficient, direction=direction
)

# add damping
damping_constant = 2e-3
rod_cylinder_parallel_contact_simulator.dampen(rod).using(
AnalyticalLinearDamper,
damping_constant=damping_constant,
time_step=time_step,
)

cylinder_height = 8 * base_length
cylinder_radius = base_radius

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class SingleRodSingleCylinderInteractionSimulator(
BaseSystemCollection, Constraints, Connections, Forcing, CallBacks
BaseSystemCollection, Constraints, Connections, Forcing, CallBacks, Damping
):
pass

Expand Down Expand Up @@ -51,7 +51,6 @@ class SingleRodSingleCylinderInteractionSimulator(
base_radius = 0.01
base_area = np.pi * base_radius ** 2
density = 1750
nu = 0.001
E = 3e5
poisson_ratio = 0.5
shear_modulus = E / (1 + poisson_ratio)
Expand Down Expand Up @@ -87,7 +86,7 @@ class SingleRodSingleCylinderInteractionSimulator(
base_length,
base_radius,
density,
nu,
0.0, # internal damping constant, deprecated in v0.3.0
E,
shear_modulus=shear_modulus,
)
Expand Down Expand Up @@ -138,11 +137,19 @@ def make_callback(self, system, time, current_step: int):
PositionCollector, step_skip=200, callback_params=recorded_cyl_history
)

# add damping
damping_constant = 1e-3
dt = 1e-4
single_rod_sim.dampen(rod1).using(
AnalyticalLinearDamper,
damping_constant=damping_constant,
time_step=dt,
)

single_rod_sim.finalize()
timestepper = PositionVerlet()
final_time = 2.0
dl = base_length / n_elem
dt = 1e-4
total_steps = int(final_time / dt)
print("Total steps", total_steps)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class SingleRodSingleCylinderInteractionSimulator(
BaseSystemCollection, Constraints, Connections, Forcing, CallBacks
BaseSystemCollection, Constraints, Connections, Forcing, CallBacks, Damping
):
pass

Expand All @@ -24,7 +24,6 @@ class SingleRodSingleCylinderInteractionSimulator(
base_radius = 0.01
base_area = np.pi * base_radius ** 2
density = 1750
nu = 0.001
E = 3e5
poisson_ratio = 0.5
shear_modulus = E / (1 + poisson_ratio)
Expand Down Expand Up @@ -65,7 +64,7 @@ class SingleRodSingleCylinderInteractionSimulator(
base_length,
base_radius,
density,
nu,
0.0, # internal damping constant, deprecated in v0.3.0
E,
shear_modulus=shear_modulus,
)
Expand Down Expand Up @@ -116,11 +115,19 @@ def make_callback(self, system, time, current_step: int):
PositionCollector, step_skip=200, callback_params=recorded_cyl_history
)

# add damping
damping_constant = 1e-3
dt = 1e-4
single_rod_sim.dampen(rod1).using(
AnalyticalLinearDamper,
damping_constant=damping_constant,
time_step=dt,
)

single_rod_sim.finalize()
timestepper = PositionVerlet()
final_time = 2.0
dl = base_length / n_elem
dt = 1e-4
total_steps = int(final_time / dt)
print("Total steps", total_steps)

Expand Down

0 comments on commit 67c3b9e

Please sign in to comment.