Skip to content

Commit

Permalink
fix: examples for removed internal damping option
Browse files Browse the repository at this point in the history
  • Loading branch information
bhosale2 committed May 3, 2023
1 parent 826c0ca commit 96734a3
Show file tree
Hide file tree
Showing 37 changed files with 71 additions and 155 deletions.
6 changes: 1 addition & 5 deletions examples/AxialStretchingCase/axial_stretching.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class StretchingBeamSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
youngs_modulus,
youngs_modulus=youngs_modulus,
shear_modulus=shear_modulus,
)

Expand All @@ -83,9 +82,6 @@ class StretchingBeamSimulator(

# add damping
dl = base_length / n_elem
# old damping model (deprecated in v0.3.0) values
# dt = 0.01 * dl
# damping_constant = 1.0
dt = 0.1 * dl
damping_constant = 0.1
stretch_sim.dampen(stretchable_rod).using(
Expand Down
12 changes: 4 additions & 8 deletions examples/Binder/1_Timoshenko_Beam.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@
" base_length,\n",
" base_radius,\n",
" density,\n",
" 0.0, # internal damping constant, deprecated in v0.3.0\n",
" E,\n",
" youngs_modulus=E,\n",
" shear_modulus=shear_modulus,\n",
")\n",
"\n",
Expand Down Expand Up @@ -310,8 +309,7 @@
" base_length,\n",
" base_radius,\n",
" density,\n",
" 0.0, # internal damping constant, deprecated in v0.3.0\n",
" E,\n",
" youngs_modulus=E,\n",
" # Unshearable rod needs G -> inf, which is achievable with a poisson ratio of -1.0\n",
" shear_modulus=E / (-0.85 + 1.0),\n",
")\n",
Expand Down Expand Up @@ -582,8 +580,7 @@
" base_length,\n",
" base_radius,\n",
" density,\n",
" 0.0, # internal damping constant, deprecated in v0.3.0\n",
" E,\n",
" youngs_modulus=E,\n",
" shear_modulus=shear_modulus,\n",
")\n",
"dynamic_update_sim.append(shearable_rod_new)\n",
Expand All @@ -607,8 +604,7 @@
" base_length,\n",
" base_radius,\n",
" density,\n",
" 0.0, # internal damping constant, deprecated in v0.3.0\n",
" E,\n",
" youngs_modulus=E,\n",
" # Unshearable rod needs G -> inf, which is achievable with a poisson ratio of -1.0\n",
" shear_modulus=E / (-0.85 + 1.0),\n",
")\n",
Expand Down
3 changes: 1 addition & 2 deletions examples/Binder/2_Slithering_Snake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@
" base_length,\n",
" base_radius,\n",
" density,\n",
" 0.0, # internal damping constant, deprecated in v0.3.0\n",
" E,\n",
" youngs_modulus=E,\n",
" shear_modulus=shear_modulus,\n",
")\n",
"\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ class GeneralConstraintSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
general_constraint_sim.append(rod1)
Expand Down
1 change: 0 additions & 1 deletion examples/ButterflyCase/butterfly.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ class ButterflySimulator(ea.BaseSystemCollection, ea.CallBacks):
base_length=total_length,
base_radius=base_radius,
density=density,
nu=0.0, # internal damping constant, deprecated in v0.3.0
youngs_modulus=youngs_modulus,
shear_modulus=shear_modulus,
position=positions,
Expand Down
6 changes: 1 addition & 5 deletions examples/ContinuumFlagellaCase/continuum_flagella.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ def run_flagella(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down Expand Up @@ -78,9 +77,6 @@ def run_flagella(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 2.5
# dt = 2.5e-5 * period
damping_constant = 0.625
dt = 1e-4 * period
flagella_sim.dampen(shearable_rod).using(
Expand Down
6 changes: 1 addition & 5 deletions examples/ContinuumSnakeCase/continuum_snake.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ def run_snake(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down Expand Up @@ -98,9 +97,6 @@ def run_snake(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 2e-3
# time_step = 8e-6
damping_constant = 2e-3
time_step = 1e-4
snake_sim.dampen(shearable_rod).using(
Expand Down
3 changes: 1 addition & 2 deletions examples/DynamicCantileverCase/dynamic_cantilever.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ class DynamicCantileverSimulator(
base_length,
base_radius,
density,
0.0,
youngs_modulus,
youngs_modulus=youngs_modulus,
)

# Add constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod1)
Expand All @@ -72,8 +71,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod2)
Expand Down Expand Up @@ -125,9 +123,6 @@ class FixedJointSimulator(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 0.4
# dt = 1e-5
damping_constant = 0.4
fixed_joint_sim.dampen(rod1).using(
ea.AnalyticalLinearDamper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ class SphericalJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
spherical_joint_sim.append(rod1)
Expand All @@ -73,8 +72,7 @@ class SphericalJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
spherical_joint_sim.append(rod2)
Expand Down Expand Up @@ -121,9 +119,6 @@ class SphericalJointSimulator(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 4e-3
# dt = 1e-5
damping_constant = 4e-3
spherical_joint_sim.dampen(rod1).using(
ea.AnalyticalLinearDamper,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ class ParallelConnection(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
parallel_connection_sim.append(rod_one)
Expand All @@ -67,8 +66,7 @@ class ParallelConnection(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
parallel_connection_sim.append(rod_two)
Expand Down Expand Up @@ -134,9 +132,6 @@ def apply_forces(self, system, time: np.float64 = 0.0):


# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 4e-2
# dt = 1e-5
damping_constant = 4e-3
dt = 1e-3
parallel_connection_sim.dampen(rod_one).using(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class SwingingFlexiblePendulumSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
youngs_modulus,
youngs_modulus=youngs_modulus,
shear_modulus=youngs_modulus / (poisson_ratio + 1.0),
)

Expand Down
3 changes: 1 addition & 2 deletions examples/FrictionValidationCases/axial_friction.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ def simulate_axial_friction_with(force=0.0):
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def simulate_rolling_friction_initial_velocity_with(IFactor=0.0):
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def simulate_rolling_friction_on_inclined_plane_with(alpha_s=0.0):
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down
3 changes: 1 addition & 2 deletions examples/FrictionValidationCases/rolling_friction_torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def simulate_rolling_friction_torque_with(C_s=0.0):
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)

Expand Down
4 changes: 1 addition & 3 deletions examples/HelicalBucklingCase/convergence_helicalbuckling.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def simulate_helicalbucklin_beam_with(
number_of_rotations = 27
# For shear modulus of 1e4, nu is 99!
poisson_ratio = 99
shear_modulus = E / (poisson_ratio + 1.0)
shear_matrix = np.repeat(1e5 * np.identity((3))[:, :, np.newaxis], n_elem, axis=2)
temp_bend_matrix = np.zeros((3, 3))
np.fill_diagonal(temp_bend_matrix, [1.345, 1.345, 0.789])
Expand All @@ -57,8 +56,7 @@ def simulate_helicalbucklin_beam_with(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
)
# TODO: CosseratRod has to be able to take shear matrix as input, we should change it as done below

Expand Down
3 changes: 1 addition & 2 deletions examples/HelicalBucklingCase/helicalbuckling.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ class HelicalBucklingSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
# TODO: CosseratRod has to be able to take shear matrix as input, we should change it as done below
Expand Down
9 changes: 2 additions & 7 deletions examples/JointCases/fixed_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod1)
Expand All @@ -62,8 +61,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod2)
Expand All @@ -89,9 +87,6 @@ class FixedJointSimulator(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 0.4
# dt = 1e-5
damping_constant = 0.4
dt = 1e-4
fixed_joint_sim.dampen(rod1).using(
Expand Down
6 changes: 2 additions & 4 deletions examples/JointCases/fixed_joint_torsion.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod1)
Expand All @@ -65,8 +64,7 @@ class FixedJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
fixed_joint_sim.append(rod2)
Expand Down
9 changes: 2 additions & 7 deletions examples/JointCases/hinge_joint.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class HingeJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
hinge_joint_sim.append(rod1)
Expand All @@ -62,8 +61,7 @@ class HingeJointSimulator(
base_length,
base_radius,
density,
0.0, # internal damping constant, deprecated in v0.3.0
E,
youngs_modulus=E,
shear_modulus=shear_modulus,
)
hinge_joint_sim.append(rod2)
Expand Down Expand Up @@ -91,9 +89,6 @@ class HingeJointSimulator(
)

# add damping
# old damping model (deprecated in v0.3.0) values
# damping_constant = 4e-3
# dt = 1e-5
damping_constant = 4e-3
dt = 5e-5
hinge_joint_sim.dampen(rod1).using(
Expand Down
Loading

0 comments on commit 96734a3

Please sign in to comment.